Best way to check if file exists

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

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


1 Like

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

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.


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