LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-12-2014, 01:39 PM   #1
Toasterman
Member
 
Registered: Oct 2013
Posts: 77

Rep: Reputation: Disabled
Rsync create folders recursively?


I have BackupPC installed which uses rsync automatically every night. As of now I can only restore files one directory deep. However, this will not work for me as I have many files and folders which need to be copied. Is there a switch for rsync that will do this?

For example, if I needed to restore a file to /var/lib/a/b/ where a and b do not currently exist, the restore would fail and I get the following error in BackupPC:
Code:
Remote[1]: rsync: mkdir "/var/lib/a/b/" failed: No such file or directory (2)
Remote[1]: rsync error: error in file IO (code 11) at main.c(576) [receiver=3.0.6]
Thanks in advance.
 
Old 08-12-2014, 02:18 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,797

Rep: Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943Reputation: 943
-r option ?

man rsync
Code:
OPTIONS SUMMARY
       Here is a short summary of the options available in rsync. Please refer
       to the detailed description below for a complete description.
[...]
 -r, --recursive             recurse into directories
[...]
 
Old 08-12-2014, 03:17 PM   #3
Toasterman
Member
 
Registered: Oct 2013
Posts: 77

Original Poster
Rep: Reputation: Disabled
Thank you but the recursive option is already enabled. Also, that recursive option deals specifically with what is being copied and restored. It won't create the parent folders of the restore destination. I was hoping there was some way to do this automatically.
 
Old 08-12-2014, 03:20 PM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Are you trying to use rsync from the command line to do this? Or are you using BackupPC?

From what I remember, BackupPC has to be used to restore BackupPC backups.
 
Old 08-13-2014, 07:41 AM   #5
Toasterman
Member
 
Registered: Oct 2013
Posts: 77

Original Poster
Rep: Reputation: Disabled
I am using BackupPC to restore backups but I'm getting the rsync error through BackupPC. The interface allows me to enter custom switches for rsync if there is anything that will accomplish what I need.
 
Old 08-15-2014, 01:06 AM   #6
Beryllos
Member
 
Registered: Apr 2013
Location: Massachusetts
Distribution: Debian
Posts: 529

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Perhaps it is not allowed by the permissions of the directory you are restoring to, or the rsync process is running under a user account that does not have permission to write in that directory.
 
Old 08-15-2014, 05:41 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,189

Rep: Reputation: 7939Reputation: 7939Reputation: 7939Reputation: 7939Reputation: 7939Reputation: 7939Reputation: 7939Reputation: 7939Reputation: 7939Reputation: 7939Reputation: 7939
I have discussed something like this with the authors of rsync and the conclusion was something like this:
rsync does not care about the dirs outside of the content (to be synced). So if they (parts of the path to the root) were not yet created rsync will fail.
 
  


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
[SOLVED] How do I rename files/folders recursively using a simple script? ixcel87 Programming 5 07-11-2012 11:02 AM
rsync files recursively but place in one remote directory wreckedred Linux - Newbie 3 01-30-2011 07:17 AM
Shell script to delete folders and files dynamically and recursively rjbaca Linux - General 1 06-21-2010 11:26 AM
find -exec command to recursively delete files and folders in folders with X name Joan Murt Linux - Newbie 2 07-08-2009 04:35 PM
How to unzip files recursively inside folders? jessdog9001 Linux - Software 2 03-22-2006 12:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:01 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
Open Source Consulting | Domain Registration