When downloading a file from Google Drive using its file ID, I'd like to be able to programmatically determine its filename (and whatever other information might be available) before actually downloading the file. E.g., so that I can display to the user what file is being downloaded, etc.
I learned from this thread, that I can use the "-i" option to see the filename before doing the actual downloading. The problem with using "-i" is that it puts rclone into interactive mode, so if I use this option while running rclone from another program, the rclone command will hang waiting for input from stdin.
I've figured out that I can work around this by feeding /dev/null into the rclone, like so:
rclone -i backend copyid my-drive: my-file-id path/to/output/dir < /dev/null
If I do the above, rclone will output the filename, along with some other verbiage to stderr, and then terminate with a non-zero exit code. I can programmatically do the above, capture the output written to stderr and parse out the filename from stderr. This works, but this approach is far from ideal. E.g., if there is a real error, dealing with the error programmatically becomes "nuanced".
It would be great if there were just some option, other than "-i" that would tell rclone to output any information it can about the file (including its filename) to stdout without downloading the file, and then to exit with a zero exit status if there were no errors in fetching the file information.
rclone v1.60.0 - os/version: darwin 10.15.4 (64 bit) - os/kernel: 19.4.0 (x86_64) - os/type: darwin - os/arch: amd64 - go/version: go1.19.2 - go/linking: dynamic - go/tags: none
rclone backend -i copyid poolq-uploads: '1t49fnYgmEd4ITJjMsRfcHXnB8f3WSBdC' test-dir/ < /dev/null
I'm not having a problem with my config. Everything is working exactly as documented. I'm just trying to find out if there is an undocumented feature that will do what I need.
$ rclone -vv backend -i copyid poolq-uploads: '1t49fnYgmEd4ITJjMsRfcHXnB8f3WSBdC' test-dir/ < /dev/null 2022/11/06 20:18:13 DEBUG : rclone: Version "v1.60.0" starting with parameters ["rclone" "-vv" "backend" "-i" "copyid" "poolq-uploads:" "1t49fnYgmEd4ITJjMsRfcHXnB8f3WSBdC" "test-dir/"] 2022/11/06 20:18:13 DEBUG : Using config file from "/Users/nessus/.config/rclone/rclone.conf" 2022/11/06 20:18:13 DEBUG : Creating backend with remote "test-dir/" 2022/11/06 20:18:13 DEBUG : fs cache: renaming cache item "test-dir/" to be canonical "/Users/nessus/s/mysrc/scala/scala-cli-examples/test-dir" rclone: copy "C5KC3ACXX.2.1.fastq.gz"? y) Yes, this is OK (default) n) No, skip this s) Skip all copy operations with no more questions !) Do all copy operations with no more questions q) Exit rclone now. y/n/s/!/q> 2022/11/06 20:18:13 Failed to read line: EOF