Repository navigation
operations: --no-block-rmdir for disposable files blocking removal of otherwise empty directory - #7512
operations: --no-block-rmdir for disposable files blocking removal of otherwise empty directory#7512nielash wants to merge 1 commit into
Conversation
0832b3b to
3719625
Compare
3719625 to
1121d2f
Compare
|
Rebased and resolved merge conflicts. |
ncw
left a comment
There was a problem hiding this comment.
This code looks neat and well implemented :-)
My immediate thoughts are
- Are users going to want to use a glob, eg
--no-block-rmdir *~for all the emacs users in the world - I think probably not but we should discuss now. - Can we think of a better name than
-no-block-rmdir? - How useful is this in the mac world? Can you describe use cases that this fixes?
Possibly! I think that would be a useful feature, at the possible cost of adding some complexity.
Haha. Some ideas:
Syncthing has a similar feature but it doesn't seem to have a name.
Pretty useful, IMO. The main use case is for
Note also that Here's another example where this came up recently on the forum: |
… otherwise empty directory Before this change, rclone commands that remove empty dirs (including rmdir, rmdirs, sync, and bisync) would silently fail to remove dirs if those dirs contained files that were excluded by filters. This can pose a problem for some automatically created system files, such as `.DS_Store` on macOS, which users often prefer to exclude from syncs -- including them makes for noisy logs, but excluding them can make it impossible to remove otherwise empty directories. After this change, a new `--no-block-rmdir` flag allows specifying a comma-separated list of such files which rclone should consider "disposable" if they block removal of otherwise empty directories. When set, if rclone fails to remove a directory, it will check the contents of the directory (ignoring any filters.) If the directory contains ONLY files on the disposable list, rclone will delete the files and then remove the directory. See also: partially-related rclone#6437
e49db3e to
ce83687
Compare
|
I just had a thought... We have a flag which almost does this already for I don't know whether this flag works for What do you think? |
I think that is different, as here we don't want to delete ALL excluded files -- only the ones with a certain name. It is common to use filters to sync only a subset of folders within a drive (but the excluded folders should not get deleted.) |
If you put all the directories that you wanted excluding into filters then I'm not fond of the UI for On the other hand the implementation is very simple and contained which is a big plus. Do you think users will always have the directories in What do you think about a name Sorry, not quite happy with this yet for reasons I'm finding hard to pin down! PS We can use |
I think I am still not understanding this point. How is it exactly the same? With
I don't quite understand the "dirs" part, as we are talking about deleting files here, not dirs. (Yes it is for the broader purpose of not blocking removal of its parent dir, if that dir would be getting removed anyway for some other reason. But it is only the file that is excluded with filters -- not the dir. In fact, this feature is only concerned with dirs which are NOT themselves excluded.) Note also that the goal here is not to
I wonder if it would be helpful to take inspiration from Syncthing's similar feature? (Search that page for |
What is the purpose of this change?
Before this change, rclone commands that remove empty dirs (including
rmdir,rmdirs,sync, andbisync) would silently fail to remove dirs if those dirs contained files that were excluded by filters. This can pose a problem for some automatically created system files, such as.DS_Storeon macOS, which users often prefer to exclude from syncs -- including them makes for noisy logs, but excluding them can make it impossible to remove otherwise empty directories.After this change, a new
--no-block-rmdirflag allows specifying a comma-separated list of such files which rclone should consider "disposable" if they block removal of otherwise empty directories. When set, if rclone fails to remove a directory, it will check the contents of the directory (ignoring any filters.) If the directory contains ONLY files on the disposable list, rclone will delete the files and then remove the directory.Was the change discussed in an issue or in the forum before?
See partially-related #6437
Checklist