Manipulating file dates

Giles Orr gilesorr-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Apr 1 12:42:45 UTC 2010


On 31 March 2010 22:29, William Park <opengeometry-FFYn/CNdgSA at public.gmane.org> wrote:
> 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... :-)

Indeed, it would.  But after Chris Johnson's email I gave "+6hours" a
test run and the date stamps on the files went 8 hours back instead of
6 hours forward.  Don't know if I did something wrong or what, but for
whatever reason the uglier method worked better for me.

-- 
Giles
http://www.gilesorr.com/
gilesorr-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
--
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