Find command and rsync combine
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 : Code:
find /home/* -type f -mtime 0 -exec rsync -avz {} /mnt/usb_harddrive/home/ \; 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. Need help and advise please. Thank's a lot. |
Why bother with find at all? rsync should take care of changed/new files - that's what it does.
|
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. Thanks a lot for your reply. |
If you want to preserve the path, it may be simplest to add the files to a tar archive,
|
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. Thank's a lot for your advise and help. |
Something like
find /home/bill/temp/ -type f -exec tar -rf /home/bill/test/b.tar {} \; |
Code:
-R, --relative |
Good call. I'd thought there was something along those lines but couldn't find it for some reason.
|
AlucardZero, I think you forgot something in your post:
Quote:
Example command: Code:
rsync -av /home/qb2 /data/qb2/backup 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. |
I ran a quick test yesterday and it didn't keep the paths.
|
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:
Quote:
|
Quote:
|
@b-RAM, you may want to try something like:
Code:
touch /home/increment Code:
find /home/* -type f -newer /home/increment -exec rsync -avzR {} /mnt/usb_harddrive/home/ \; I haven't tested the exact code, but the jist is correct. HTH. BM. |
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. |
Quote:
|
All times are GMT -5. The time now is 07:25 AM. |