I am trying to exclude the #recycle
directory with rsync:
$ rsync -Hauv -h -P --exclude '#recycle/' --exclude @eaDir/ --exclude '.DS_Store*' --exclude desktop.ini user1@src_server:/volume2/Extension_1 /destination/dir/
receiving incremental file list
Extension_1/#recycle/subDir1/subDir2/
Extension_1/#recycle/subDir1/subDir2/BigVideo.mov
39.23G 82% 36.40MB/s 0:03:44 ^C
$
(I also tried quoting .DS_Store*
and removing the --log-file
option, but they made no difference.)
I am using rsync
version 3.1.2 protocol version 31
on CentOS 7.9 with bash
version 4.2.46(2)-release
.
To be more specific, I wrote a very small script with a variable that contains the exclusion list
$ rsyncExclusionOptions=$(printf -- "--exclude %s " "'#recycle/'" @eaDir/ "'.DS_Store*'" desktop.ini)
$ echo $rsyncExclusionOptions
--exclude '*/#recycle/' --exclude @eaDir/ --exclude '.DS_Store*' --exclude desktop.ini
$ rsync -Hauv -h -P --skip-compress=$rsyncSkipCompressList $rsyncExclusionOptions user1@src_server:/volume2/Extension_1 /destination/dir/
receiving incremental file list
Extension_1/#recycle/SERIES/mySerie/SOURCES_HD59iDF/EPISODES_666-709/
Extension_1/#recycle/SERIES/mySerie/SOURCES_HD59iDF/EPISODES_666-709/TOEI_myEpisode.mov
3.22G 5% 104.35MB/s 0:08:23 ^CKilled by signal 2.
rsync error: unexplained error (code 255) at rsync.c(638) [generator=3.1.2]
rsync: [generator] write error: Broken pipe (32)
rsync error: received SIGUSR1 (code 19) at main.c(1430) [receiver=3.1.2]
EDIT0 : @roaima I also tried putting #
between brackets (as suggested in the link you provided here) but it did not work either :
$ rsyncExclusionOptions=$(printf -- "--exclude %s " "'[#]recycle/'" @eaDir/ "'.DS_Store*'" desktop.ini)
$ echo $rsyncExclusionOptions
--exclude '[#]recycle/' --exclude @eaDir/ --exclude '.DS_Store*' --exclude desktop.ini
$ rsync -Hauv -h -P --skip-compress=$rsyncSkipCompressList $rsyncExclusionOptions user1@src_server:/volume2/Extension_1 /destination/dir/
receiving incremental file list
Extension_1/#recycle/SERIES/mySerie/SOURCES_HD59iDF/EPISODES_666-709/
Extension_1/#recycle/SERIES/mySerie/SOURCES_HD59iDF/EPISODES_666-709/TOEI_myEpisode.mov
4.04G 7% 21.67MB/s 0:39:45 ^CKilled by signal 2.
rsync error: unexplained error (code 255) at rsync.c(638) [generator=3.1.2]
rsync: [generator] write error: Broken pipe (32)
rsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at io.c(504) [receiver=3.1.2]
rsync: [receiver] write error: Broken pipe (32)
A WORKING SOLUTION :
- The hash had be put between brackets like this :
[#]
AND - The extra
'
must not be used for the[#]recycle
exclusion inside thersyncExclusionOptions
variable :
$ rsyncExclusionOptions=$(printf -- "--exclude %s " "[#]recycle/" @eaDir/ "'.DS_Store*'" desktop.ini)
$ echo $rsyncExclusionOptions
--exclude [#]recycle/ --exclude @eaDir/ --exclude '.DS_Store*' --exclude desktop.ini
$ rsync -Hauv -h -P --skip-compress=$rsyncSkipCompressList $rsyncExclusionOptions user1@src_server:/volume2/Extension_1 /destination/dir/
receiving incremental file list
Extension_1/SERIES/mySerie/SOURCES_VF/EPISODES_700-765/
rsyncExclusionOptions=$(printf -- "--exclude %s " "'#recycle/'" ...)
, then why isecho $rsyncExclusionOptions
returning--exclude '*/#recycle/'
? Where is the*/
coming from?