Hello,

If I rename a directory full of files, or a bunch of files, and I use
Rsync to update the directory tree, Rsync will upload all these files
again and delete the old ones.  This is suboptimal since all the data is
already there.

Rsync should be able to check for renamed files by scanning for files
with the same MD5 hashes, checksums, or delta signatures (is that what
you called them?).  Rsync could then rename the files remotely and then
do the normal update.

Here is a shellscript implementation:
#!/bin/sh
TO_DO='
- Secure shell script
  - Find out how to secure shell scripts
- Do filename escaping beforehand
- Provide Tar-like "-C" command line option
'
tmpfile=md5_rename_tmp
find -type f -print0 | xargs -0 md5sum > "$tmpfile"
for file in "$@" ; do
        old_IFS="$IFS"
        IFS='
'
        for new_line in `cat "$file"` ; do
                IFS="$old_IFS"
                new_md5=`echo "$new_line" | cut -d' ' -f1`
                new_pathname=`echo "$new_line" | cut -d' ' -f3-`
                old_pathname=`grep -m1 "$new_md5" "$tmpfile" | \
                        cut -d' ' -f3-`
                if [ "$old_pathname" ] ; then
                        mkdir -p `dirname "$new_pathname"`
                        mv "$old_pathname" "$new_pathname"
                fi
        done
done

-- 
Tom Goulet, [EMAIL PROTECTED], D8BAD3BC, http://web.em.ca/~tomg/contact.html

Attachment: pgp00000.pgp
Description: PGP signature

-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to