Best way to check if file exists

Hi,
I would like to know the most efficient way to check if a file exists in a remote (GDrive).

Also,
a way to see which files are missing from a list of files.

Thanks.

This is one way

rclone lsf remote:path-to-file

You'll need to check you actually get the filename in the listing though.

Doing this via the rc would be most efficient though as there is some overhead starting the backend. Eg with https://rclone.org/rc/#operations-list-list-the-given-remote-and-path-in-json-format

rclone has the perfect internal api for this fs.NewObject.. Maybe the thing should be to add a operations/newobject to the rc. This would then do the absolute minimum needed and return an error or something about the object.

There is rclone check which you can pass --files-from to.

I'm a fan of using rclone lsf on the source and dest and then using comm to find missing things.

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.