Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi all, sorry for disturbing your time i've got some question to ask,
laterly i try to backup just new modified file to my usb harddrive using find command and rsync like this :
the result is all new files can be backup but the directory of that file is not backup, can anyone advise me about that?, cause i know rsync just backup the file based the path on find command but if that command only backup the new files without the directory it will be messy' and in the future i will confuse when loaded that files.
I also had try to delete -type f but the result is it's backup not only
backup the directory and new modified file but also old files had been backup.
Thanks for your reply billymayday. ^^
I use find at all cause i use a new HDD backup if i just use rsync to backup home data to that new HDD Backup, i will just backup all files to HDD backup while the last files had been backup to my old HDD Backup. So, on my new HDD backup i just need to backup change/modified files and in the end i have 2 Backup one old and one new with modified/change file/new file.
Need advise or any method can you tell me to backup new modified file/change file with include the directory.
Sorry, do you mean to make that files on new hdd backup became tar files?, but when i extract that tar file someday it's include
with directory something like this:
when i backup new modified files it's include the directory where that files i backup ex: stock.xls on folder /home/warehouse/stock_data/.
And sorry billymayday for my noob, how do i make the backup become tar on new HDD Backup.
-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 this command:
rsync -av /foo/bar/baz.c remote:/tmp/
... this would create a file named baz.c in /tmp/ on the remote machine. If instead
you used
rsync -avR /foo/bar/baz.c remote:/tmp/
then a file named /tmp/foo/bar/baz.c would be created on the remote machine, pre‐
serving its full path. These extra path elements are called “implied directories”
(i.e. the “foo” and the “foo/bar” directories in the above example).
AlucardZero, I think you forgot something in your post:
Quote:
Beginning with rsync 3.0.0, rsync always sends these implied
directories as real directories in the file list, even if a path
element is really a symlink on the sending side. This prevents
some really unexpected behaviors when copying the full path of a
file that you didn't realize had a symlink in its path.
IOW, -R is now the default behavior. I did a doublecheck on my backups and the paths are preserved within the directory structure of the backup directory.
Example command:
Code:
rsync -av /home/qb2 /data/qb2/backup
The example file /home/qb2/Chess/Bird.pgn would be saved as /data/qb2/backup/qb2/Chess/Bird.pgn
Or am I misunderstanding the whole issue?
BTW, if the object of this is to make a faithful backup of a whole drive, then the proper way would probably be to setup a RAID1.
Actually it works with the -a option that I didn't test with of course
Edit - actually is doesn't, and I assume this is because find passes the full filename, not just a higher path (ie, rsync -av /home/qb2/Chess/bird.pgn /data/qb2/backup, would produce /data/qb2/backup/Bird.pgn, not /data/qb2/backup/qb2/Chess/Bird.pgn)
Quote:
find ~/temp -type f -exec rsync -avR {} ~/test \;
seems to work OK though (although it puts the whole path in place):
Quote:
$ ll /home/bill/temp
total 8.0K
-rw-r--r-- 1 bill users 289 May 28 13:29 t1
-rw-r--r-- 1 bill users 289 May 28 13:30 t2
$ ll /home/bill/test/home/bill/temp
total 8.0K
-rw-r--r-- 1 bill users 289 May 28 13:29 t1
-rw-r--r-- 1 bill users 289 May 28 13:30 t2
Last edited by billymayday; 05-28-2009 at 05:33 PM.
Edit - actually is doesn't, and I assume this is because find passes the full filename, not just a higher path (ie, rsync -av /home/qb2/Chess/bird.pgn /data/qb2/backup, would produce /data/qb2/backup/Bird.pgn, not /data/qb2/backup/qb2/Chess/Bird.pgn)
You're misquoting me. I said that for the command "rsync -av /home/qb2 /data/qb2/backup" an example file "/home/qb2/Chess/Bird.pgn" would be saved as "/data/qb2/backup/qb2/Chess/Bird.pgn".
What this does it timestamp /home/increment, then find everything newer than touch /home/increment, rsync those files, then update the timestamp for the next run. This way, if you backup doesn't run for any given period, it will still backup anything changed in the meantime.
I haven't tested the exact code, but the jist is correct.
Sorry - that's not what I meant. What you have works as you've stated. What I meant is that it doesn't work in conjunction with the find command. I was trying to put it in context for what the OP is trying to do.
Does that make sense? Apologies for any confusion.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.