Rsync can do this function with the
-u or --update flags.
From the rsync man page:
This forces rsync to skip any files which exist on the destinaâ
tion and have a modified time that is newer than the source
file. (If an existing destination file has a modify time equal
to the source fileâs, it will be updated if the sizes are
In the current implementation of --update, a difference of file
format between the sender and receiver is always considered to
be important enough for an update, no matter what date is on the
objects. In other words, if the source has a directory or a
symlink where the destination has a file, the transfer would
occur regardless of the timestamps. This might change in the
future (feel free to comment on this on the mailing list if you
have an opinion).
If you don't want to use rsync I can think of two other ways to get this info. But both ways would require you to drill down through the file system.
First the uglier way:
stat --format=%y <file> and parse the outputted time. You would have to do some pretty ugly things to get this working right.
Second the slicker way:
find <path> -mtime -<number_of_days> to get a list of files that have been modified within the number_of_days ago window.
Re: Power saving
This would take some hacking, and wouldn't be 100% reliable - in the sense you might miss something that needs to be backed up. But you can do something like the following and just not run against home drives during certain windows:
if [ `date +%k` -lt 22] && [`date +%k` -gt 8] && [ `date +%u` -le 5 ]
#Set some flags for run control.
The first date test, checks to see if it is before 10pm, the second after 8am and the last checks that the day of the week is less than or equal to 5 (
date +%u outputs day of week from 1-7 with one being Monday, so 6 & 7 are Saturday and Sunday)
As far as holidays, the only thing I can really think of doing is to maintain a file with the day number of the year in it for each holiday then match against