A problem with rclone delete from list

Hello! from the last version of rclone, i have a little problem.

I need to erase (purge/rmdirs/delete) a list of folder es:
/folder1/subfolder1/
/folder2/
/folderx/subfolderx/subsubfolder/

I have create a list (similar to sync command or delete or copy) in include-from and in files-from mode. I have try to add some wildcards (ex: /folder1/subfolder1/**) or add some variations (folder/subfolder) etc. I have try various command (purge/rmdirs/delete), and preserve root ( --leave-root) flags... but I have the same problem...

if subfolder1 is empty and folder1 is empty too, the command erase the two folder, not only that i give in the list (/folder1/subfolder1/)

Is a little bug? there are some solution?
thanks...
Giancarlo.

Can you give an example command please?

It's best to use the template as that collects all the information rather than just deleting the big template that asks you to stop and please read it.

Hi Nick, thanks.. the example:

rclone version
rclone v1.54.0-beta.5027.cb97c2b0d
- os/arch: linux/amd64
- go version: go1.15.6

rclone tree .
/
├── filetobeerased.txt
├── folder-1
│ └── subfolder_1
│ └── sub-sub-folder_1
├── folder-2
│ ├── file_inutile.txt
│ └── sub-folder_2
├── folder-3
└── prova.zip

cat filetobeerased.txt
/folder-1/subfolder_1/sub-sub-folder_1/**
/folder-2/sub-folder_2/**

rclone delete --include-from "filetobeerased.txt" --rmdirs -vv .
2021/02/08 18:59:38 DEBUG : rclone: Version "v1.54.0-beta.5027.cb97c2b0d" starting with parameters ["rclone" "delete" "--include-from" "filetobeerased.txt" "--rmdirs" "-vv" "."]
2021/02/08 18:59:38 DEBUG : Creating backend with remote "."
2021/02/08 18:59:38 DEBUG : Using config file from "/home/aldo/.config/rclone/rclone.conf"
2021/02/08 18:59:38 DEBUG : fs cache: renaming cache item "." to be canonical "/home/aldo/Scrivania/prova"
2021/02/08 18:59:38 DEBUG : Waiting for deletions to finish
2021/02/08 18:59:38 DEBUG : filetobeerased.txt: Excluded
2021/02/08 18:59:38 DEBUG : prova.zip: Excluded
2021/02/08 18:59:38 DEBUG : folder-3: Excluded
2021/02/08 18:59:38 DEBUG : folder-2/file_inutile.txt: Excluded
2021/02/08 18:59:38 DEBUG : fs cache: switching user supplied name "." for canonical name "/home/aldo/Scrivania/prova"
2021/02/08 18:59:38 DEBUG : folder-3: Removing directory
2021/02/08 18:59:38 DEBUG : folder-2/sub-folder_2: Removing directory
2021/02/08 18:59:38 DEBUG : folder-1/subfolder_1/sub-sub-folder_1: Removing directory
2021/02/08 18:59:38 DEBUG : folder-1/subfolder_1: Removing directory
2021/02/08 18:59:38 DEBUG : folder-1: Removing directory
2021/02/08 18:59:38 DEBUG : 2 go routines active

new tree...
/
├── filetobeerased.txt
├── folder-2
│ └── file_inutile.txt
└── prova.zip

This doesn't allow me to delete only a folder indicated by an "include-file" ... there are a workaround?

This is the reason rclone is removing directories.

  --rmdirs   rmdirs removes empty directories but leaves root intact

As implemented --rmdirs removes all the empty directories it can.

However this is easy to fix - can you give this a go?

v1.55.0-beta.5165.14f9121a4.fix-rmdirs-filter on branch fix-rmdirs-filter (uploaded in 15-30 mins)

Hello Nick,

Little different but not resolve... new situation

rclone tree .
/
├── filetobeerased.txt
├── folder-1
│ └── subfolder_1
│ -------- └── sub-sub-folder_1
├── folder-2
│ ├── file_inutile.txt
│ └── sub-folder_2
├── folder-3

cat filetobeerased.txt
/folder-1/subfolder_1/**
/folder-1/subfolder_1/sub-sub-folder_1/**
/folder-2/sub-folder_2/**

./newclone delete --rmdirs --include-from "filetobeerased.txt" -vv .
2021/02/09 11:44:36 DEBUG : rclone: Version "v1.55.0-beta.5165.14f9121a4.fix-rmdirs-filter" starting with parameters ["./thisclone" "delete" "--rmdirs" "--include-from" "filetobeerased.txt" "-vv" "."]
2021/02/09 11:44:36 DEBUG : Creating backend with remote "."
2021/02/09 11:44:36 DEBUG : Using config file from "/home/aldo/.config/rclone/rclone.conf"
2021/02/09 11:44:36 DEBUG : fs cache: renaming cache item "." to be canonical "/home/aldo/Scrivania/prova"
2021/02/09 11:44:36 DEBUG : Waiting for deletions to finish
2021/02/09 11:44:36 DEBUG : filetobeerased.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-3: Excluded
2021/02/09 11:44:36 DEBUG : folder-2/file_inutile.txt: Excluded
2021/02/09 11:44:36 DEBUG : fs cache: switching user supplied name "." for canonical name "/home/aldo/Scrivania/prova"
2021/02/09 11:44:36 DEBUG : filetobeerased.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-3: Excluded
2021/02/09 11:44:36 DEBUG : folder-2/file_inutile.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-2/sub-folder_2: Removing directory
2021/02/09 11:44:36 DEBUG : folder-2: Removing directory
2021/02/09 11:44:36 ERROR : folder-2: Failed to rmdir: remove /home/aldo/Scrivania/prova/folder-2: directory not empty
2021/02/09 11:44:36 ERROR : Attempt 1/3 failed with 1 errors and: remove /home/aldo/Scrivania/prova/folder-2: directory not empty
2021/02/09 11:44:36 DEBUG : Waiting for deletions to finish
2021/02/09 11:44:36 DEBUG : filetobeerased.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-3: Excluded
2021/02/09 11:44:36 DEBUG : folder-2/file_inutile.txt: Excluded
2021/02/09 11:44:36 DEBUG : fs cache: switching user supplied name "." for canonical name "/home/aldo/Scrivania/prova"
2021/02/09 11:44:36 DEBUG : thisclone: Excluded
2021/02/09 11:44:36 DEBUG : filetobeerased.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-3: Excluded
2021/02/09 11:44:36 DEBUG : folder-2/file_inutile.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-2: Removing directory
2021/02/09 11:44:36 ERROR : folder-2: Failed to rmdir: remove /home/aldo/Scrivania/prova/folder-2: directory not empty
2021/02/09 11:44:36 ERROR : Attempt 2/3 failed with 1 errors and: remove /home/aldo/Scrivania/prova/folder-2: directory not empty
2021/02/09 11:44:36 DEBUG : Waiting for deletions to finish
2021/02/09 11:44:36 DEBUG : thisclone: Excluded
2021/02/09 11:44:36 DEBUG : filetobeerased.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-3: Excluded
2021/02/09 11:44:36 DEBUG : folder-2/file_inutile.txt: Excluded
2021/02/09 11:44:36 DEBUG : fs cache: switching user supplied name "." for canonical name "/home/aldo/Scrivania/prova"
2021/02/09 11:44:36 DEBUG : filetobeerased.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-3: Excluded
2021/02/09 11:44:36 DEBUG : folder-2/file_inutile.txt: Excluded
2021/02/09 11:44:36 DEBUG : folder-2: Removing directory
2021/02/09 11:44:36 ERROR : folder-2: Failed to rmdir: remove /home/aldo/Scrivania/prova/folder-2: directory not empty
2021/02/09 11:44:36 ERROR : Attempt 3/3 failed with 1 errors and: remove /home/aldo/Scrivania/prova/folder-2: directory not empty
2021/02/09 11:44:36 DEBUG : 2 go routines active
2021/02/09 11:44:36 Failed to delete: remove /home/aldo/Scrivania/prova/folder-2: directory not empty

new tree
├── filetobeerased.txt
├── folder-1
│ └── subfolder_1
│ -------└── sub-sub-folder_1
├── folder-2
│ └── file_inutile.txt
├── folder-3

rclone now correctly delete /folder-2/sub-folder_2/ but not remove /folder-1/subfolder_1/sub-sub-folder_1/ and /folder-1/subfolder_1/
in the report i see they try tree times to delete /folder-2 and this is not in the filetobeerased.txt

OK, try this

v1.55.0-beta.5165.358c0832c.fix-rmdirs-filter on branch fix-rmdirs-filter (uploaded in 15-30 mins)

Ok! This is perfect! :wink:

Thanks for testing.

I've merged this to master now which means it will be in the latest beta in 15-30 mins and released in v1.55

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