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

Re: [solved] Re: rsync issue



Hi, Rodolfo:

On Friday 17 September 2010 15:07:10 Rodolfo Medina wrote:
> Rodolfo Medina <rodolfo.medina@gmail.com> writes:
> >> 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.

[...]

> Thanks to Rob and Karl for their help.  The following seems to work:
>
>  $ rsync -vrtul --delete --exclude='rodolfo/.*' rodolfo 192.168.0.2:/home
>
> , and I'll create the symlinks by hand.  Maybe there's a better solution: I
> wish the `delete' option worked also for files and not only for
> directories, but in rsync manual couldn't find that.

Recheck.  --delete certainly works on files.  Your problem is you can't rely 
on object names in order to know what has to be copied or not, since the name 
of both the hidden files and the symlinks check against the same pattern.

Since you have a pattern problem, you may build a component list and then 
apply it as a filter (see the "filters" section from rsync's man page).

Since you want to copy everything but top level hidden files I'd try something 
like this two-step procedure (next command is a single line):

1) find /path/to/rodolfo -maxdepth 1 -type 
f -name '.*' -fprint /path/to/filterfile

Then within /path/to/filterfile there should be the list of hidden files you 
want to ignore.

2) After that, the rsync step should do the trick, kindof (next command is a 
single line) :
rsync -a --exclude-from=/path/to/filterfile /path/to/rodolfo/ 
remoteuser@remotehost:/path/to/rodolfo

I didn't test the above commands so there might be minor flaws you should 
check but I think you get the idea.

Cheers.


Reply to: