This is looking good and very helpful to an rsync novice. I will try the modification rsync --dry-run -avi --delete --filter 'protect /*’ --filter ‘protect /.*’ SOURCE/ TARGET/ and see what it produces. I do have a number of directories and files beginning with a dot in TARGET and these need to be protected. Unfortunately, the output from —dry-run is still likely to be sufficiently extensive that looking over it won’t be a completely certain test. I therefore ask "Does the above modification seem right to the experts?” Two supplementary points, if I may. Do you advise -ai or -avi? And why do you prefer one over the other? I don’t understand the line of rsync output that reads .d..t...... ./ David> On 23 Feb 2017, at 17:02, <Francis.Montagnac at inria.fr> <Francis.Montagnac at inria.fr> wrote: > > > Hi. > > On Thu, 23 Feb 2017 11:07:16 -0500 Kevin Korb wrote: > >> I hate to say it because it goes against my normal advice but this is >> one instance where using a * in the source parameter would help... > > I totally agree. > > I thing that using a protect filter achieves this goal (without using > a * thus). > > Example: > > mkdir SOURCE/{a,b,c} > mkdir TARGET/d > > ## FAIL: delete d > rsync --dry-run -ai --delete SOURCE/ TARGET/ > *deleting d/ > .d..t...... ./ > cd+++++++++ a/ > cd+++++++++ b/ > cd+++++++++ c/ > > ## OK: for this trivial test > rsync --dry-run -ai --delete --filter 'protect /*' SOURCE/ TARGET/ > .d..t...... ./ > cd+++++++++ a/ > cd+++++++++ b/ > cd+++++++++ c/ > > You may need to read carefully the FILTER RULES section of the rsync > manual. I didn't count the number of time I read it :-) > > --- > Francis
Either solution should work fine. Your dry run results should be the same. -v and -i are only output modifying options they don't actually change the way that rsync works. The extra string there is explained in the --itemize-changes section of the man page but that particular one means that the times tamp on the directory is different. On 02/23/2017 01:07 PM, David Epstein wrote:> This is looking good and very helpful to an rsync novice. I will try the modification > > rsync --dry-run -avi --delete --filter 'protect /*’ --filter ‘protect /.*’ SOURCE/ TARGET/ > > and see what it produces. I do have a number of directories and files beginning with a dot in TARGET and these need to be protected. > Unfortunately, the output from —dry-run is still likely to be sufficiently extensive that looking over it won’t be a completely certain test. > > I therefore ask > "Does the above modification seem right to the experts?” > > Two supplementary points, if I may. Do you advise -ai or -avi? And why do you prefer one over the other? > I don’t understand the line of rsync output that reads > > .d..t...... ./ > > David > >> On 23 Feb 2017, at 17:02, <Francis.Montagnac at inria.fr> <Francis.Montagnac at inria.fr> wrote: >> >> >> Hi. >> >> On Thu, 23 Feb 2017 11:07:16 -0500 Kevin Korb wrote: >> >>> I hate to say it because it goes against my normal advice but this is >>> one instance where using a * in the source parameter would help... >> >> I totally agree. >> >> I thing that using a protect filter achieves this goal (without using >> a * thus). >> >> Example: >> >> mkdir SOURCE/{a,b,c} >> mkdir TARGET/d >> >> ## FAIL: delete d >> rsync --dry-run -ai --delete SOURCE/ TARGET/ >> *deleting d/ >> .d..t...... ./ >> cd+++++++++ a/ >> cd+++++++++ b/ >> cd+++++++++ c/ >> >> ## OK: for this trivial test >> rsync --dry-run -ai --delete --filter 'protect /*' SOURCE/ TARGET/ >> .d..t...... ./ >> cd+++++++++ a/ >> cd+++++++++ b/ >> cd+++++++++ c/ >> >> You may need to read carefully the FILTER RULES section of the rsync >> manual. I didn't count the number of time I read it :-) >> >> --- >> Francis-- ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., Kevin Korb Phone: (407) 252-6853 Systems Administrator Internet: FutureQuest, Inc. Kevin at FutureQuest.net (work) Orlando, Florida kmk at sanitarium.net (personal) Web page: http://www.sanitarium.net/ PGP public key available on web site. ~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._., -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 191 bytes Desc: OpenPGP digital signature URL: <http://lists.samba.org/pipermail/rsync/attachments/20170223/8419925e/signature.sig>
On Thu, 23 Feb 2017 18:07:20 +0000 David Epstein wrote:> I will try the modification> rsync --dry-run -avi --delete --filter 'protect /*’ --filter ‘protect /.*’ SOURCE/ TARGET/The 'protect /.*’ is useless: unlike the shell, rsync interprets * simply as a path component, regardless thus if it starts with a dot or not. From the man: a '*' matches any path component, but it stops at slashes.> Unfortunately, the output from —dry-run is still likely to be > sufficiently extensive that looking over it won’t be a completely > certain test.Then redirect to a file and grep deleting in this file. --- Francis
On Fri, 24 Feb 2017 07:51:56 +0100 Francis.Montagnac at inria.fr wrote:>> Unfortunately, the output from —dry-run is still likely to be >> sufficiently extensive that looking over it won’t be a completely >> certain test.> Then redirect to a file and grep deleting in this file.Given the format of --itemize-changes, you can also use awk to restrict the output to the direct subdirs. Example; mkdir -p SOURCE/a/x mkdir TARGET/.z rsync --dry-run -ai --delete SOURCE/ TARGET/ *deleting d/ *deleting .z/ .d..t...... ./ cd+++++++++ a/ cd+++++++++ a/x/ cd+++++++++ b/ cd+++++++++ c/ ## FAIL rsync --dry-run -ai --delete SOURCE/ TARGET/ | awk -F/ 'NF == 2 && $1 ~ /deleting/ {print}' *deleting d/ *deleting .z/ ## OK: no output rsync --dry-run -ai --delete --filter 'protect /*' SOURCE/ TARGET/ | awk -F/ 'NF == 2 && $1 ~ /deleting/ {print}' -- Francis