--filter-from not deleting folders

Hi all,
Pleasure to be using rclone sync, wonderful tool.

I've been fiddling with --filter-from to reach exactly wht I want, and was suprised to find out it wouldn't purge empty folders, only treating files

using :

rclone sync /xxx /xxx --filter-from syncconfig1.txt

with

# syncconfig1 file content
+ /A/**
+ /B/**
+ /C/**
- *

Turns out a removed folder from one of the source folders included in the conf file ends up in the destination as an empty folder...

I'm sure it's been covered before, having though searched through the forum and thoroughly read https://rclone.org/filtering/#include-from-read-include-patterns-from-file

Many thanks for your help.
Regards

For source, I use:

--delete-empty-src-dirs

Is that what you are looking for as I use:

/usr/bin/rclone move /data/local/ gcrypt: --log-file /opt/rclone/logs/upload.log -v --drive-chunk-size 64M --exclude-from /opt/rclone/scripts/excludes --delete-empty-src-dirs
1 Like

Thank you.

Will this flag purge the empty directories from source or from destination ?
(the src word is bit confusing...)

Definitely source as I move locally to my GD and want to remove that. I wasn't sure if that was the direction you were speaking of though.

Ok. I'm looking to purge from destination :slightly_smiling_face:
I'm using rclone sync,
from source to destination,
after running rclone sync command,
destination keeps unwanted empty folders that have been previously purged from source
(unlike a regular rclone sync without --filter-from)

Thanks as I get the flow now.

I think it's this bug ->

Oh. Bugger.
:roll_eyes:

Many thanks for your help !

Hmm. Actually in reading it a bit more, I think it isn't it.

If I summarize, you have a source directory that was removed but with the filter-from on the destination side, it still shows there.

If you remove the filter-from and sync, it removes it.

You can work around that by doing a rclone rmdirs after the move which I believe should remove empty directories.

Yes that sure works.
Thank you for your time and understanding.

Of course, considering I'm using a filter-from file, that would technically imply running the command for each folders listed in there...
Which kind of defeats the purpose of having a filter-from file to start with, since it's there to prevent me from running seperate sync commands for each folder... :smiley:

Yeah, I'd file an issue on the github and just list the steps/link back to the forum article and it does seem to be a bug.

1 Like

Yes. Many thanks for your help !