[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rsync issue



>> On Sun, 12 Sep 2010 18:30:59 +0200, 
>> Rodolfo Medina <rodolfo.medina@gmail.com> said:

R> I wish to copy all my home directory into another machine with the
R> --delete option, but:
R> 1) I don't want hidden files, i.e.: `.*' to be copied;
R> 2) there are some symlinks, beginning with `.', that I want to be copied.

   Instead of copying everything and deleting what you don't want, why not
   make a list of the files you want copied and have rsync use that instead?
   Something like this:

       list=/tmp/list$$     # or use mktemp
       cd $HOME

       # Ignore hidden files and "." directory...
       find . -print | egrep -v '^(./\.|\.$)' > $list

       # ...but keep symlinks starting with a dot.
       find . -type l -name '.*' -print >> $list

       rsync --files-from=$list [other rsync options, destination, etc]
       rm $list

   You can add any other filtering you might want after the last "find",
   you *know* exactly what files are being synced, and you can store that
   list someplace in case there's ever a question of why something did (or
   didn't) get copied.
    
-- 
Karl Vogel                      I don't speak for the USAF or my company
I have never hated a man enough to give his diamonds back.  --Zsa Zsa Gabor


Reply to: