Re: rsync issue
On Sun, Sep 12, 2010 at 06:30:59PM +0200, Rodolfo Medina wrote:
> Hi to all Debian users.
>
> In rsync manual I coudn't find a solution to what I want. I wish to copy all
> my home directory into another machine with the --delete option, but:
>
> 1) I dont't want hidden files, i.e.: `.*' to be copied;
>
> 2) on the other hand, there are some symlinks, beginning with `.', that I want
> to be copied.
>
> The --exclude option won't help.
>
> >From my home directory, if I do:
>
> $ rsync -vrtul --delete * 192.168.0.2:/home/rodolfo
>
> , hidden files that are in `~/' are not copied at all nor the --delete option
> applies to files that are in `~/', so it's not good; from /home, if I do:
>
> $ rsync -vrtul --delete rodolfo 192.168.0.2:/home
>
> , everything is copied, also system hidden directories and files, which I don't
> want.
>
Would it be ok to copy everything, and then delete the hidden files and
directories afterwards? I know you can tell the 'find' command to
discriminate between files, directories, and symbolic links by using the
'-type' switch. Maybe something like this would work (test it first,
because I haven't):
find /home/rodolpho/ -maxdepth 1 -iname ".*" -type f -exec rm {} \;
find /home/rodolpho/ -maxdepth 1 -iname ".*" -type d -exec rm -r {} \;
These commands find all the hidden files and directories (but not
symlinks) in your home directory (but not subdirectories) and deletes
them.
-Rob
Reply to:
- References:
- rsync issue
- From: Rodolfo Medina <rodolfo.medina@gmail.com>