MEPIS Community Forum

A Linux operating system based on Debian Stable
View unanswered posts | View unsolved topics | View active topics |



Reply to topic  [ 5 posts ] 
rsync question 
Author Message
MEPIS Guide
MEPIS Guide
User avatar

Joined: Thu Jul 13, 2006 7:21 am
Posts: 1842
Location: albuquerque
Has thanked: 130 times
Have thanks: 156 times
Post # 300038
Post rsync question
Maybe I'm missing something in man rsync. What does a trailing slash on the destination do?

rsync -av source destination
rsync -av source destination/

Looks like those two do the same thing; same with:

rsync -av source/ destination
rsync -av source/ destination/


Sun May 20, 2012 12:42 pm
Profile
Online
MEPIS Enthusiast
MEPIS Enthusiast
User avatar

Joined: Wed Jul 12, 2006 1:42 am
Posts: 4374
Has thanked: 417 times
Have thanks: 568 times
Post # 300047
Post Re: rsync question
I don't know if the trailing slash for the destination matters, I know the one for the source is important, otherwise rsync creates a subfolder in the destinatiion folder with the source folder name


Sun May 20, 2012 3:11 pm
Profile
MEPIS Guide
MEPIS Guide
User avatar

Joined: Thu Jul 13, 2006 7:21 am
Posts: 1842
Location: albuquerque
Has thanked: 130 times
Have thanks: 156 times
Post # 300048
Post Re: rsync question
Yep, that's how I'm reading it. Looking through man rsync, some of the examples show a slash trailing the destination and some don't. That's a long document; I couldn't find an explanation for the trailing slash on the destination, but you'd think there's a reason for it.


Sun May 20, 2012 3:55 pm
Profile
MEPIS Guide
MEPIS Guide
User avatar

Joined: Mon Jun 30, 2008 8:06 pm
Posts: 2952
Has thanked: 52 times
Have thanks: 376 times
Post # 300051
Post Re: rsync question
malspa wrote:
rsync -av source destination
rsync -av source destination/


the slash in the second example should cause source to be copied INTO the destination directory. if source is a directory, then source would be recreated under destination.

Quote:
rsync -av source/ destination
rsync -av source/ destination/


the first example should copy all the files in source to destination, but i believe it will not recreate the source directory


Sun May 20, 2012 7:07 pm

GoManutd thanked by: Adrian
Profile
MEPIS Guide
MEPIS Guide
User avatar

Joined: Thu Jul 13, 2006 7:21 am
Posts: 1842
Location: albuquerque
Has thanked: 130 times
Have thanks: 156 times
Post # 300054
Post Re: rsync question
GoManutd wrote:
malspa wrote:
rsync -av source destination
rsync -av source destination/


the slash in the second example should cause source to be copied INTO the destination directory. if source is a directory, then source would be recreated under destination.

Quote:
rsync -av source/ destination
rsync -av source/ destination/


the first example should copy all the files in source to destination, but i believe it will not recreate the source directory


I think GoManutd hit on it. In my test, the trailing slash on the destination made a difference only if source was a file. If source was a directory, the slash trailing the destination didn't do anything -- the slash trailing the source controlled what happened.


Sun May 20, 2012 7:53 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.