Reputation: 5648
I can't find difference between two directories: what updated, and what deleted. After that I need save new files into archive and a list of deleted files.
After that I need with copy of first directory + delta go to new directory and recreate there directory 2.
All this must be fast =)
I tried rsync
time rsync -rv --dry-run --delete ./10 ./130
sent 775081 bytes received 105052 bytes 352053.20 bytes/sec
total size is 838724381 speedup is 952.95 (DRY RUN)
real 0m1.270s
user 0m0.300s
sys 0m0.484s
But I don't see deleted files
rsync version 3.0.9 protocol version 30 Copyright (C) 1996-2011 by Andrew Tridgell, Wayne Davison, and others. Web site: http://rsync.samba.org/
Maybe I don't understand someting:
[email protected]:/home.local/diff# rm -rf a/
[email protected]:/home.local/diff# rm -rf b
[email protected]:/home.local/diff# mkdir a b
[email protected]:/home.local/diff# touch b/ssdf
[email protected]:/home.local/diff# touch a/c
[email protected]:/home.local/diff# rsync --dry-run -i --delete-delay --stats -a a b |grep "deleting"
[email protected]:/home.local/diff# rsync --dry-run -i --delete-delay --stats -a a b
cd+++++++++ a/
>f+++++++++ a/c
Number of files: 2
Number of files transferred: 1
I created in directory files which don't exists in another but they wouldn't delete?
Upvotes: 1
Views: 966
Reputation: 136256
rsync
may not necessarily be faster. What you are observing is Linux filesystem caching:
$ time find /usr/share > /dev/null
real 0m6.779s
user 0m0.082s
sys 0m0.199s
$ time find /usr/share > /dev/null
real 0m0.109s
user 0m0.043s
sys 0m0.064s
Notice how the second search is instantaneous.
Upvotes: 1