Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rsync: provide a list of unsent files

Tags:

rsync

The Rsync -u flag prevents the overwriting of modified destination files. How can I get a list of files that were not sent due to this flag? The -v flag will let me know which files were sent, but I would like to know which ones weren't.

like image 396
dotancohen Avatar asked Feb 15 '12 21:02

dotancohen


People also ask

What is dry run in rsync?

What is rsync –dry-run? “–dry-run” option allows the rsync command to run a trial without making any changes—most of the time, this process the same output as the real execution. The rsync command is combined with various options to specify what the rsync command will do before someone can execute it.

Will rsync create directories?

Copy/Sync a File on a Local Computer In the above example, you can see that if the destination is not already existed rsync will create a directory automatically for the destination.

Is rsync recursive?

The rsync tool can recursively navigate a directory structure and update a second location with any new/changed/removed files. It checks to see if files exist in the destination before sending them, saving bandwidth and time for everything it skips.


1 Answers

From the rsync man page:

-i, --itemize-changes

Requests a simple itemized list of the changes that are being made to each file, including attribute changes. This is exactly the same as specifying --out-format='%i %n%L'. If you repeat the option, unchanged files will also be output, but only if the receiving rsync is at least version 2.6.7 (you can use -vv with older versions of rsync, but that also turns on the output of other verbose messages).

In my testing, the -ii option isn't working with rsync 3.0.8, but -vv is. Your mileage may vary.

You could also get substantially the same information by invoking rsync with --dry-run and --existing in the opposite direction. So if your regular transfer looked like this:

rsync --update --recursive local:/directory/ remote:/directory/

You would use:

rsync --dry-run --existing --recursive remote:/directory/ local:/directory/

but -vv or -ii is safer and less prone to misinterpretation.

like image 115
blahdiblah Avatar answered Jan 01 '23 11:01

blahdiblah