LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-18-2014, 12:29 AM   #1
ASTRAPI
Member
 
Registered: Feb 2007
Posts: 210

Rep: Reputation: 16
Question Remote Rsync and subfolders option


Hi

I try to remote rsync from one server to another using:

Code:
rsync -avh /home/backup/ root@123.456.789.000:/home/destination
and i want to ask if it will copy the subdirectories from /home/backup/ like /home/backup/folder1 and the files inside the subdirectories also?

If not what command should i use?

Thanks
 
Old 11-18-2014, 12:39 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

yes it will. This is because the -a (or --archive) option invokes the -r (--recursive) option. See the man page for details. Also, you should test for yourself before performing commands you are unsure of as root.

Evo2.
 
Old 11-18-2014, 07:22 AM   #3
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Yes it would. But the trailing "/" in the source makes sense and is not ignored. If there is a trailing "/", it will only copy the contents of the source folder. But if you ignore the trailing "/", an additional folder would be created in the destination.

Code:
rsync -avh /home/backup/ root@123.456.789.000:/home/destination
Will not copy backup directory itself, but only the contents of the backup directory.

Code:
rsync -avh /home/backup root@123.456.789.000:/home/destination
Will actually create a new directory called "backup" in the destination folder.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync --force option not working? kayasaman Fedora 16 07-12-2016 09:18 PM
rsync option question digitolx Linux - Software 3 04-26-2010 12:25 PM
rsync option in cygwin ufmale Linux - Newbie 2 01-25-2009 12:06 PM
rsync with -d option tate_harmann Linux - Newbie 2 09-20-2006 01:58 PM
Using the exclude option absolutely with rsync karlovac Programming 0 03-01-2004 12:39 PM


All times are GMT -5. The time now is 07:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration