Results 1 to 3 of 3
I'm using Ubuntu 10.04 32 bit but this should apply to linux, in general.
I am having a curious problem with an rsync script. Although I could opt to just ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-20-2011 #1Just Joined!
- Join Date
- Apr 2005
- Posts
- 37
[SOLVED] Rsync refuses to create folder.
I'm using Ubuntu 10.04 32 bit but this should apply to linux, in general.
I am having a curious problem with an rsync script. Although I could opt to just back up my complete home folder, I choose to be selective and only backup what I would actually need if a hard drive disaster occurred. I am having difficulty backing up properly when I back up files in a subfolder but no files from the base folder the subfolder is under. Rsync refuses to create the base folder in the backup target partition and therefore will not create the subfolder and files either.
Here's an example. It's my ".config" folder. There are a number of subfolders but I am only interested in backing up the "transmission" subfolder. My line for that in my script is this:
When I run it I get this error message:Code:rsync -arv /home/trapper/.config/transmission/ /media/RSYNC-Backup/trapper/.config/transmission/
However, this works and creates the .mozilla folder and it's entire contents, including subfolders & all subfolder files, at the backup target.Code:rsync: mkdir "/media/RSYNC-Backup/trapper/.config/transmission" failed: No such file or directory (2) rsync error: error in file IO (code 11) at main.c(595) [Receiver=3.0.7] rsync: connection unexpectedly closed (9 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(601) [sender=3.0.7]
Just to test, I added this to my script just prior to the transmission backup line:Code:rsync -arv /home/trapper/.mozilla/ /media/RSYNC-Backup/trapper/.mozilla/
The function above created the .config folder at the target and then the transmission folder backed up properly.Code:if [ ! -d /media/RSYNC-Backup/trapper/.config ] then mkdir /media/RSYNC-Backup/trapper/.config fi
I obviously have something wrong and am confused over the fact that rsync refuses to automagically create a ,config base folder for me. What do I not know that I should know?
- 01-20-2011 #2
I believe you want the --relative flag.
man rsyncCode:rsync -arvR /home/trapper/.config/transmission/ /media/RSYNC-Backup/trapper/
Code:-R, --relative Use relative paths. This means that the full path names specified on the command line are sent to the server rather than just the last parts of the filenames. This is particularly useful when you want to send several different directories at the same time. For example, if you used the command rsync foo/bar/foo.c remote:/tmp/ then this would create a file called foo.c in /tmp/ on the remote machine. If instead you used rsync -R foo/bar/foo.c remote:/tmp/ then a file called /tmp/foo/bar/foo.c would be created on the remote machine. The full path name is preserved.
- 01-20-2011 #3Just Joined!
- Join Date
- Apr 2005
- Posts
- 37
Well, this is what I want and not what I want.Code:rsync -arvR /home/trapper/.config/transmission/ /media/RSYNC-Backup/trapper/

This produces a /home/trapper/.config/transmission folder under /media/RSYNC-Backup/trapper
What I was actually looking for was a .config/transmission folder under /media/RSYNC-Backup/trapper.
However, all this you wrote also created a brain flash and an understanding why the .config folder is not created under /media/RSYNC-Backup/trapper
I am probably better off if I adjust the rest of my script to use the --relative flag and simply back up to /media/RSYNC-Backup/. That will give me /media/RSYNC-Backup/home/trapper/"Everything I am backing up in my script"
I can deal with that and will do it that way. Thanks for your assistance. I appreciate it.




