Manipulating file dates

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Thu Apr 1 02:29:55 UTC 2010


On Wed, Mar 31, 2010 at 09:59:31PM -0400, Giles Orr wrote:
> I did actually mean the file date stamp, but you're right that I
> should consider the exif data.  Because of the way my local scripts
> handle processing, it was important I fix the date stamp, and I've
> done that with this:
> 
> for file in *.JPG; do touch -d "$(date -d @$((21600 + $(date -r
> "${file}" +"%s"))) +"%Y-%m-%d %H:%M:%S")" "${file}" ; done

Something like
    date -d '6 hours'
would have been easier... :-)

> 
> Which is what I mentioned in the first place: convert to seconds since
> 1970, add six hours (21600 seconds), nail the "@" symbol on the front
> of the number so "date" will take it as a number-of-seconds value and
> spit it out in a different format, and finally touch the file with
> that value.
> 
> I really should change the exif data: just because I don't need it
> right now isn't a good reason to leave it wrong ...
> 
> Thanks everyone for the assistance.

-- 
William

--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list