Rclone --dry-run purge on encrypted drive

So I did a rather big sync to an offsite encrypted b2 bucket and after it completed I realized that I should have excluded some folders. I changed my script to --exclude those (and it appears like it would work). Since it looks like the rclone sync with the --exclude is not deleting these files from the remote (but also not uploading those), I tried to manually delete/purge these folders. Because I don't want to accidentally delete files, I want to double check what it would delete, using the --dry-run command. But I am struggling to get it to show me what it would delete.

This is what I run (trying to delete .foo folders):

$ rclone --dry-run purge 'encrypted-backup:.foo/'
2019/08/14 18:24:19 NOTICE: Encrypted drive 'encrypted-backup:.foo/': Not purging as --dry-run set

I know there are lots of .foo folders, because they show up when I do an rclone ls. I haven't been able to figure out what I'm doing wrong, am I running into a bug maybe?

Thanks for any ideas/hints!

rclone purge deletes everything so be sure you want to use it as it doesn't use filters or anything else. It's a nuke basically.

I think you want to use rclone delete instead and you can see what would be deleted via dry-run.

https://rclone.org/commands/rclone_delete/

I tried the delete command as well, but it also doesn't show me what it would delete with --dry-run.

$ rclone --dry-run delete 'encrypted-backup:.foo/**'
$

outputs nothing.

rclone doesn't understand wildcards there it will be looking for a directory called 'encrypted-backup:.foo/**'

Try

rclone --dry-run delete 'encrypted-backup:.foo'

I tried this and it doesn't give me any output, yet when I do a .rclone ls I can see numerous .foo folders with lots of files.

Share the command you are running and the output like:

[felix@gemini ~]$ rclone delete gcrypt:test --dry-run -vv
2019/08/17 10:07:03 DEBUG : rclone: Version "v1.48.0" starting with parameters ["rclone" "delete" "gcrypt:test" "--dry-run" "-vv"]
2019/08/17 10:07:03 DEBUG : Using config file from "/opt/rclone/rclone.conf"
2019/08/17 10:07:04 INFO  : Waiting for deletions to finish
2019/08/17 10:07:04 NOTICE: hosts: Not deleting as --dry-run
2019/08/17 10:07:04 DEBUG : 5 go routines active
2019/08/17 10:07:04 DEBUG : rclone: Version "v1.48.0" finishing with parameters ["rclone" "delete" "gcrypt:test" "--dry-run" "-vv"]
[felix@gemini ~]$

I list the b2 encrypted backup like this:

$ rclone --fast-list ls 'encrypted-backup:'
.....
    19726 documents/Family Tree/.foo/s100FamilyTree.jpg
     4333 documents/Family Tree/.foo/s100FamilyTree.pdf
.....

It's a massive amount of files, but it does show that there are several thousand files in various folders called .foo

Then I try to delete all of these (but want to see what it would delete first, so I use --dry-run):

$ rclone --dry-run -vv delete 'encrypted-backup:.foo'
2019/08/17 15:33:17 DEBUG : rclone: Version "v1.45" starting with parameters ["rclone" "--dry-run" "-vv" "delete" "encrypted-backup:.foo"]
2019/08/17 15:33:17 DEBUG : Using config file from "/home/tomuta/.config/rclone/rclone.conf"
2019/08/17 15:33:17 INFO  : Waiting for deletions to finish
2019/08/17 15:33:18 DEBUG : 6 go routines active
2019/08/17 15:33:18 DEBUG : rclone: Version "v1.45" finishing with parameters ["rclone" "--dry-run" "-vv" "delete" "encrypted-backup:.foo"]

It doesn't show any further output.

It does not show any output because you are trying to delete

and the directory is not present as it is

You can check out:

https://rclone.org/filtering/#directories

But if you are trying to match the path you have listed, I think you need something like

**/\.foo/**

So give this a try as I think it should work:

[felix@gemini ~]$ rclone delete gcrypt: --include '**/\.foo/**' --dry-run -vv
2019/08/17 21:55:58 DEBUG : rclone: Version "v1.48.0" starting with parameters ["rclone" "delete" "gcrypt:" "--include" "**/\\.foo/**" "--dry-run" "-vv"]
2019/08/17 21:55:58 DEBUG : Using config file from "/opt/rclone/rclone.conf"
2019/08/17 21:55:59 INFO  : Waiting for deletions to finish
2019/08/17 21:56:06 DEBUG : mounted: Excluded from sync (and deletion)
2019/08/17 21:56:06 NOTICE: test/.foo/hosts: Not deleting as --dry-run

Indeed, specifying "" (root) as the path and then using the pattern match in --include instead did the trick. I actually read that page and couldn't get it to work, but I believe it was because I was missing the **/ before .foo, so it would have only worked if there was a .foo directory right in the root directory (which in my case there isn't).

Thanks!

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