which rsync command?

Francis.Montagnac at inria.fr Francis.Montagnac at inria.fr
Fri Feb 24 07:17:19 UTC 2017



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



More information about the rsync mailing list