1 月 162024
 

Source: Handling renamed files or directories in rsync

Here is a tool that is designed to work before rsync is run: rsync-sidekick

This propagates following changes from source directory to destination directory (or any combination of below):

  1. Change in file modification timestamp
  2. Rename of file/directory
  3. Moving a file from one directory to another

rsync options such as --detect-renamed--detect-renamed-lax--detect-moved and --fuzzy don’t work reliably and sometimes are dangerous! rsync-sidekick is reliable alternative to all these options and much more.

11 月 172015
 

Source: Efficiently delete large directory containing thousands of files

Using rsync is surprising fast and simple.

mkdir empty_dir
rsync -a --delete empty_dir/    yourdirectory/

@sarath’s answer mentioned another fast choice: Perl! Its benchmarks are faster than rsync -a --delete.

cd yourdirectory
perl -e 'for(<*>){((stat)[9]<(unlink))}'

Sources:

  1. http://stackoverflow.com/questions/1795370/unix-fast-remove-directory-for-cleaning-up-daily-builds
  2. http://www.slashroot.in/which-is-the-fastest-method-to-delete-files-in-linux

rsync can be faster than plain rm, because it guarantees the deletes in correct order, so less btress recomputation is needed. See this answer serverfault.com/a/328305/105902