I had a hard drive nearing capacity (mostly
/home). I installed a new larger drive, copied
/home over to it and went on with my life.
This was on 5/17/2013. I know it was on 5/17/2013 because I forgot the archive flag when I copied everything, so every file on the server that has not been updated since then is dated 5/17/2013.
I still have the original
/home directory (
/oldhome) with the correct last-modified dates.
I need a starting point to write a script that would replace each file in
/home that is dated 5/17/2013 with the corresponding original file from
/oldhome (with the proper date intact). I would only want to replace files dated 5/17/2013, as some files that were present on that date have subsequently been updated and I, of course, want to keep the updated versions of those files.
File count in
/oldhome is ~63K
Thoughts on where to begin?
OK. Based on Theophrastus's comment below (thank you), I can start with:
find -type f -newermt 2013-5-17 ! -newermt 2013-5-18 -print0 | xargs -I % -0 rsync -avzI --dry-run /oldhome% /home%
...which I think might be almost there. The output from
find has a leading period which breaks the path in the rsync command (we get
/oldhome./directory/filename /home./directory/filename.ext when everything is concatenated. Can I restate
find statement somehow to leave off the leading period? The purpose is to identify files in
/home with the 5/17/2013 date and replace them with a copy from
/oldhome - there are no files in
/oldhome dated later than 5/17/2013.