I am using rsync to copy over multimedia files from linux workstation to my Qnap NAS TS-559 Pro II. I have been editing many of the files within album directories and deleting some. I am getting the error messages "cannot delete empty directory," which would be OK except that when I go to the directories in question using NAs web interface and File Station, the directories are empty. I thought perhaps there were hidden files like thumbnails causing the problem but the directories show empty even with "show hidden files" enabled.
What is happening and how may I overrule this behavior please?
Budgie
Help Rsync cannot delete non-empty directories on NAS
-
- Know my way around
- Posts: 242
- Joined: Wed Feb 27, 2008 7:57 am
- OneCD
- Guru
- Posts: 12163
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Help Rsync cannot delete non-empty directories on NAS
Budgie wrote:I am using rsync to copy over multimedia files from linux workstation to my Qnap NAS TS-559 Pro II. I have been editing many of the files within album directories and deleting some. I am getting the error messages "cannot delete empty directory," which would be OK except that when I go to the directories in question using NAs web interface and File Station, the directories are empty. I thought perhaps there were hidden files like thumbnails causing the problem but the directories show empty even with "show hidden files" enabled.
Martin Höger wrote:Did you try to add --delete-excluded?
Message cannot delete non-empty directory happens easily if delete a directory on the source side and then you want to run rsync --delete. Rsync will not let you delete the excluded files in the directory.
-
- Know my way around
- Posts: 242
- Joined: Wed Feb 27, 2008 7:57 am
Re: Help Rsync cannot delete non-empty directories on NAS
Hi and many thanks for your quick reply. I am a bit out of my depth here but believe I understand your suggestion. However here is my command line:-OneCD wrote:Budgie wrote:I am using rsync to copy over multimedia files from linux workstation to my Qnap NAS TS-559 Pro II. I have been editing many of the files within album directories and deleting some. I am getting the error messages "cannot delete empty directory," which would be OK except that when I go to the directories in question using NAs web interface and File Station, the directories are empty. I thought perhaps there were hidden files like thumbnails causing the problem but the directories show empty even with "show hidden files" enabled.Martin Höger wrote:Did you try to add --delete-excluded?
Message cannot delete non-empty directory happens easily if delete a directory on the source side and then you want to run rsync --delete. Rsync will not let you delete the excluded files in the directory.
Code: Select all
rsync -h --progress --stats -r -tgo -p -D --update --delete-after --filter=protect .@__thumb --delete-excluded --exclude=**/*tmp*/ --exclude=**/*cache*/ --exclude=**/*Cache*/ --exclude=/mnt/*/** --exclude=/media/*/** --exclude=**/lost+found*/ --exclude=/var/run/** --exclude=/run/** --exclude=/proc/** --exclude=/dev/** --exclude=/sys/** --exclude=**/*Trash*/ --exclude=**/*trash*/ --exclude=.@__thumb --protect-args /home/alastair/mastermedia/Music/ admin@192.168.169.130:/share/Multimedia/Music/
- OneCD
- Guru
- Posts: 12163
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Help Rsync cannot delete non-empty directories on NAS
I've not used filters myself (never had to), so I may be entirely wrong on this, but I think your argument syntax needs to be changed. I'm looking at the section of your argument string immediately preceding the --delete-excluded option.Budgie wrote:You can see --delete-excluded is there so I don't know what to try next. All suggestions gratefully received.Code: Select all
rsync -h --progress --stats -r -tgo -p -D --update --delete-after --filter=protect .@__thumb --delete-excluded --exclude=**/*tmp*/ --exclude=**/*cache*/ --exclude=**/*Cache*/ --exclude=/mnt/*/** --exclude=/media/*/** --exclude=**/lost+found*/ --exclude=/var/run/** --exclude=/run/** --exclude=/proc/** --exclude=/dev/** --exclude=/sys/** --exclude=**/*Trash*/ --exclude=**/*trash*/ --exclude=.@__thumb --protect-args /home/alastair/mastermedia/Music/ admin@192.168.169.130:/share/Multimedia/Music/
Code: Select all
--filter=protect .@__thumb
Code: Select all
--filter='protect .@__thumb'
Suggest trying it with single quotes as shown.
-
- Know my way around
- Posts: 242
- Joined: Wed Feb 27, 2008 7:57 am
Re: Help Rsync cannot delete non-empty directories on NAS
Hi, and thanks. No time right now but surely command is filter=protect so single quotes should go thus:- '.@_thumb'
Will try it as soon as I get time.
Thanks again,
Budgie
Will try it as soon as I get time.
Thanks again,
Budgie
- OneCD
- Guru
- Posts: 12163
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Help Rsync cannot delete non-empty directories on NAS
Nope, the literal quotes need to include the whitespace char.Budgie wrote:No time right now but surely command is filter=protect so single quotes should go thus:- '.@_thumb'
-
- Know my way around
- Posts: 242
- Joined: Wed Feb 27, 2008 7:57 am
Re: Help Rsync cannot delete non-empty directories on NAS
But not, afaik the word protect which must be before the quote.
- OneCD
- Guru
- Posts: 12163
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Help Rsync cannot delete non-empty directories on NAS
(sigh!)Budgie wrote:But not, afaik the word protect which must be before the quote.
http://www.computerhope.com/unix/rsync.htm
http://blog.mudflatsoftware.com/blog/20 ... ter-rules/--filter ’protect emptydir/’
--filter='dir-merge /.rsync-filter'
--filter='- .rsync-filter'
https://lists.samba.org/archive/rsync/2 ... 16178.html--filter='P /some/dir'
--filter='-p .DS_Store'
--filter='H /some/dir'
http://serverfault.com/questions/150269 ... with-rsync--filter='+ /rsync-filter' --filter=': ./rsync-filter'
I picked four Google results at random from the first search results page for "rsync filter syntax" (something you could have done).--filter='+ /var/' \
--filter='+ /var/backups/' \
--filter='- /var/*' \
I think it would be easier (and a lot less typing for both of us) if you just tried your rsync again with the single quotes as I suggested.
-
- Know my way around
- Posts: 242
- Joined: Wed Feb 27, 2008 7:57 am
Re: Help Rsync cannot delete non-empty directories on NAS
Hi and apologies, I stand corrected. Can't try it now as I have sorted problem directories one at a time using File Station web controls. I found it was only a few but I have more editing to do in future so will try it then.
Many thanks again.
Many thanks again.