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.

2 Answers 2

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
  • Thanks for your answer and rclone, sure I will make an issue if that helps.
    – Mike
    Jun 25, 2016 at 9:28
  • Deleting file by file is so slow in huge folders with tiny files
    – Freedo
    Dec 4, 2019 at 10:33
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 :)

1
  • I just tested it, it works! It is not exactly what I was looking for, but thanks and vote up. I can keep an empty folder ready for this occasion.
    – Mike
    Sep 22, 2015 at 21:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .