LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Command line: How do I backup files modified after a specific date only (https://www.linuxquestions.org/questions/linux-general-1/command-line-how-do-i-backup-files-modified-after-a-specific-date-only-565221/)

rm_-rf_windows 06-28-2007 06:59 PM

Command line: How do I backup files modified after a specific date only
 
I'd like to backup files that I modified after a specific date, say April 1, 2007 and only those files. I'd also like these files to remain in their specific, corresponding directories and would like the 'tree' to remain as is. Is there a simple way of doing this by running a command or script? I'd then be burning these files onto a DVD. In other words, the last time I would have backed up my data onto DVD would have been April 1, 2007 / March 31, 2007 and I don't want to save what's already been saved.

pcardout 06-28-2007 08:25 PM

Quote:

Originally Posted by rm_-rf_windows
I'd like to backup files that I modified after a specific date, say April 1, 2007 and only those files. I'd also like these files to remain in their specific, corresponding directories and would like the 'tree' to remain as is. Is there a simple way of doing this by running a command or script? I'd then be burning these files onto a DVD. In other words, the last time I would have backed up my data onto DVD would have been April 1, 2007 / March 31, 2007 and I don't want to save what's already been saved.

Check out rsync. This command will synchronize any two machines, or any two directories
in one machine. It is a REALLY good way to accomplish incremental backups to a USB hard-drive
for example. It checks dates and sizes and only updates the new stuff. It
keeps your file trees intact and can recurse through directories. It is also blazingly
fast. I do not know whether DVD's are rewriteable more than once, but if they are, you could
probably use rsync with DVDs. I really recommend an external hard-drive though. That is a forever
backup solution and you don't have to track all those DVDs.

Tinkster 06-28-2007 08:34 PM

Quote:

Originally Posted by rm_-rf_windows
I'd like to backup files that I modified after a specific date, say April 1, 2007 and only those files. I'd also like these files to remain in their specific, corresponding directories and would like the 'tree' to remain as is. Is there a simple way of doing this by running a command or script? I'd then be burning these files onto a DVD. In other words, the last time I would have backed up my data onto DVD would have been April 1, 2007 / March 31, 2007 and I don't want to save what's already been saved.

I believe the last backup was 90 days ago?

Code:

find -type f -ctime -90 > new_files.txt
tar czf 20070629.tar.gz -T new_files.txt

[edit]
I found doing the maths with the date ugly ... so I found
a bash-script online that does differences between dates;
if you always know what the last back-up date was you could
use that and maybe make a wrapper or modify it so you don't
need to enter two dates.

http://www.codelibary.com/Bash/24108887.html
[/edit]


Cheers,
Tink


All times are GMT -5. The time now is 07:44 PM.