rsync question

Feel free to talk about anything and everything in this board. Just don't post offensive topics that are meant to cause trouble with other members or are derogatory towards people of different genders, race, color, minors (this includes nudity and sex), politics or religion. Let's try to keep peace among the community and for visitors.

No spam on this or any other forums please! If you post advertisements on these forums, your account may be deleted.

Do not copy and paste entire or even up to half of someone else's words or articles into posts. Post only a few sentences or a paragraph and make sure to include a link back to original words or article. Otherwise it's copyright infringement.

You can talk about other distros here, but no MEPIS bashing. You can email the developer of MEPIS if you just want to say you dislike or hate MEPIS.
Message
Author
User avatar
malspa
Forum Guide
Forum Guide
Posts: 1935
Joined: Thu Jul 13, 2006 7:21 am

rsync question

#1 Postby malspa » Sun May 20, 2012 12:42 pm

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/

User avatar
Adrian
Forum Veteran
Forum Veteran
Posts: 6366
Age: 41
Joined: Wed Jul 12, 2006 1:42 am

Re: rsync question

#2 Postby Adrian » Sun May 20, 2012 3:11 pm

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

User avatar
malspa
Forum Guide
Forum Guide
Posts: 1935
Joined: Thu Jul 13, 2006 7:21 am

Re: rsync question

#3 Postby malspa » Sun May 20, 2012 3:55 pm

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.

User avatar
GoManutd
Forum Guide
Forum Guide
Posts: 2952
Joined: Mon Jun 30, 2008 8:06 pm

Re: rsync question

#4 Postby GoManutd » Sun May 20, 2012 7:07 pm

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.

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

User avatar
malspa
Forum Guide
Forum Guide
Posts: 1935
Joined: Thu Jul 13, 2006 7:21 am

Re: rsync question

#5 Postby malspa » Sun May 20, 2012 7:53 pm

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.

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.


Return to “General”

Who is online

Users browsing this forum: Bing [Bot] and 0 guests