3

I use rclone with Ubuntu 12.04 to upload files from server to Google Drive. Everything works fine, but I can not figure out, with what command I can delete all files in directory. I have a remote called gdrive.

I tried using empty path:

root@machine:~$ rclone purge gdrive:
2015/09/13 00:54:02 Attempt 1/3 failed with 1 errors and: Can't purge root directory
2015/09/13 00:54:02 Attempt 2/3 failed with 1 errors and: Can't purge root directory
2015/09/13 00:54:02 Attempt 3/3 failed with 1 errors and: Can't purge root directory
2015/09/13 00:54:02 Failed to purge: Can't purge root directory

I tried using *:

root@machine:~$ rclone purge gdrive:*
2015/09/13 00:56:49 Attempt 1/3 failed with 1 errors and: Couldn't find directory: "*"
2015/09/13 00:56:49 Attempt 2/3 failed with 1 errors and: Couldn't find directory: "*"
2015/09/13 00:56:49 Attempt 3/3 failed with 1 errors and: Couldn't find directory: "*"
2015/09/13 00:56:49 Failed to purge: Couldn't find directory: "*"

Using purge to delete directories and files I know the name of works fine, but I can not guess how to delete all files in the root directory at once and the documentation on rclone's commands is poor.

Mike
  • 5,931

2 Answers2

4

Another alternative would be to use

rclone delete gdrive:

Which will delete all the files on gdrive:

It won't delete the directories though - rclone doesn't manage those properly yet (See rclone issue #100 for more info).

Anyway, if you'd like rclone purge to work on the root of drive then I suggest you make an issue.

Hope that helps!

PS I'm the author of rclone ;-)

2

Looking for more information on rclone I stumbled on your question. What I thought of is to sync with a empty directory, as of:

rclone sync /path/to/a/empty/folder gdrive:

Theoretically it could work, going with the written on http://rclone.org/docs/ as premise: "Sync the source to the destination, changing the destination only... Destination is updated to match source, including deleting files if necessary." It's just a workaround and I haven't tested it, just thought it'd be good to mention. Good luck :)

Tiago
  • 36