'rsync' and parent directory question

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Tue Sep 14 01:03:32 UTC 2004


o.O

As is often the case, I ask a question and then I find an answer... 
*sigh*...

   For the record;

   If you use the '--files-from=<file>' switch '--relative' will create 
the parent dirs in the destination relative to the directories in the 
file and ignore directories behind the source directory used when 
'rsync' was called. For example, if in my 'copy.txt' file I had:

path/to/file.txt

and I called 'rsync' using (many switches ignored):

$ rsync --files-from=copy.txt /mnt/dir1 /mnt/dir2

'rsync' would create:

/mnt/dir2/path/to/file.txt

   I haven't tested this yet but if I got this wrong somehow I'll report 
back.

Thanks all!

Madison


Madison Kelly wrote:
> Hi all,
> 
>   Is there a way to tell 'rsync' to duplicate the parent directory of a 
> file MINUS the mount point? For example, say I have a filesystem mounted 
> at:
> 
> /mnt/dir1/
> 
> and within it I have a subdirectory like:
> 
> /mnt/dir1/path/to/file.txt
> 
> and I want to copy 'file.txt' to another mounted filesystem mounted at:
> 
> /mnt/dir2/
> 
> while preserving the parent dir:
> 
> /path/to
> 
> So that I get:
> 
> /mnt/dir2/path/to/file.txt
> 
>   How could I do this? As I understand it by using '-R' (relative) 
> 'rsync' will create:
> 
> /mnt/dir2/mnt/dir1/path/to/file.txt
> 
>   This obviosuly is cumbersome and ugly. Have I understood this wrong or 
> missed an obvious solution? I hope not, I would feel foolish if I did. :p
> 
> Thanks as always!
> 
> Madison
> -- 
> The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
> 

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list