Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 11-18-2014, 01:29 AM   #1
Registered: Feb 2007
Posts: 210

Rep: Reputation: 16
Question Remote Rsync and subfolders option


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

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?

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

Rep: Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289Reputation: 1289

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.

Old 11-18-2014, 08:22 AM   #3
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.

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.

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


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 10:18 PM
rsync option question digitolx Linux - Software 3 04-26-2010 01:25 PM
rsync option in cygwin ufmale Linux - Newbie 2 01-25-2009 01:06 PM
rsync with -d option tate_harmann Linux - Newbie 2 09-20-2006 02:58 PM
Using the exclude option absolutely with rsync karlovac Programming 0 03-01-2004 01:39 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:09 AM.

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