BASH: Keep original mod date of a file and 'date' it back to same file?
I would really like to preserve a file's original modified date and pass it back to the file as the same attribute after a script has worked on it. I get a lot of JPEG files from different places on the Net which I either turn around and upload or burn to disk, and having the "original" date of either download or last mod in a graphics app would be for me, in the long run, a lot more helpful when deciding, for instance, which files to "recycle" or pass on backing up more than once.
I've tried doing this on my own every now and then. Where I run into problems is that it appears "stat" and "date" use different formats for date information, and I can't seem to puzzle out how to "translate" one to the other satisfactorily for the latter command.
Just to give an example:
stat foo.jpg |grep Modify gives me
Modify: 2010-07-12 06:28:56.890625000 -0400
Passing that string as-is to date foo.jpg, I get the error
date: unknown option -- 0 and the usual semi-courteous suggestion to Try 'date --help' for more information.
Somehow my TexInfo database got screwed up somewhere along the line and
gives me the short article on date input formats, not the full documentation for the command. So any help in this regard would be much appreciated.