rsync with relative path

This is a discussion on rsync with relative path within the shell forums in Operating Systems category; I use rsync to copy files to a different server, maintaining the file directory hierarchy. E.g. I need all files with *.cir extension within subdirectories of / home/user/simscript/20080826_1134: rsync -rlpogtR -v --include */ --include *.cir --exclude * -e ssh /home/user/simscript/20080826_1134 user-at-eda4:/ I need to maintain permissions and mod. time of the copied file. My problem is, that with the above command, also permissions of e.g. / home/user is (potentially) changed. How can (easily) I fix that? Can it be done using rsync? Note that the file MUST be located at the exact same location ...

Go Back   Database Forum > Operating Systems > shell

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-26-2008, 07:39 AM
Default rsync with relative path

I use rsync to copy files to a different server, maintaining the file
directory hierarchy.

E.g. I need all files with *.cir extension within subdirectories of /
home/user/simscript/20080826_1134:

rsync -rlpogtR -v --include "*/" --include "*.cir" --exclude "*" -e
ssh /home/user/simscript/20080826_1134 user-at-eda4:/

I need to maintain permissions and mod. time of the copied file.

My problem is, that with the above command, also permissions of e.g. /
home/user is (potentially) changed. How can (easily) I fix that? Can
it be done using rsync?

Note that the file MUST be located at the exact same location on both
servers. I.e. /home/user/simscript/20080826_1134/foo/bar/foo.test
should be copied to that exact location on the destination server.

Best regards,
Kenneth
Reply With Quote
  #2  
Old 08-26-2008, 08:21 AM
Default Re: rsync with relative path

If it is not clear from the previous formulations, my question is:

How can I copy the files in subdirectories of a given directory
(maintaining path, permissions and modification time) without changing
the permission of parent directories?

/Kenneth
Reply With Quote
  #3  
Old 08-26-2008, 08:39 AM
Default Re: rsync with relative path

Kenneth Brun Nielsen wrote:
> I use rsync to copy files to a different server, maintaining the file
> directory hierarchy.
>
> E.g. I need all files with *.cir extension within subdirectories of /
> home/user/simscript/20080826_1134:
>
> rsync -rlpogtR -v --include "*/" --include "*.cir" --exclude "*" -e
> ssh /home/user/simscript/20080826_1134 user-at-eda4:/
>
> I need to maintain permissions and mod. time of the copied file.
>
> My problem is, that with the above command, also permissions of e.g. /
> home/user is (potentially) changed. How can (easily) I fix that? Can
> it be done using rsync?
>
> Note that the file MUST be located at the exact same location on both
> servers. I.e. /home/user/simscript/20080826_1134/foo/bar/foo.test
> should be copied to that exact location on the destination server.
>
> Best regards,
> Kenneth


( cd /home/user/simscript && \
rsync -rlpogtR -v --include "*/" --include "*.cir" --exclude "*" \
-e ssh 20080826_1134 user-at-eda4:/home/user/simscript )

The cd is only effective within the ( )

--
echo imhcea\.lophc.tcs.hmo |
sed 's2\(....\)\(.\{5\}\)2\2\122;s1\(.\)\(.\)1\2\11g;1 s;\.;::;2'
Reply With Quote
  #4  
Old 08-26-2008, 09:45 AM
Default Re: rsync with relative path

On 26 Aug., 13:39, Michael Tosch
wrote:

> ( cd /home/user/simscript && \
> rsync -rlpogtR -v --include "*/" --include "*.cir" --exclude "*" \
> -e ssh 20080826_1134 user-at-eda4:/home/user/simscript )


Quite obvious - and it works. Thanks
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 11:54 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.