[plug] Adjust a timestamp by a specified amount

Bernard Blackham bernard at blackham.com.au
Sun Nov 9 11:08:57 WST 2003


On Sun, Nov 09, 2003 at 01:17:53PM +1030, Onno Benschop wrote:
> Before I start writing code, anyone know of a way of changing a file's
> time stamp by a set amount? If that question wasn't clear, I've got
> seven directories with photos from seven different cameras, each not
> syncronised to each other. I want all files to be using the same time,
> so that when I use all files in time-stamp order, I get a real sequence
> from all cameras... So directory 1 might be an hour off, directory 2
> might be 11 minutes off...

I'm sure a combination of stat and touch could do the trick.
Something like:

touch -d "`stat -c%X $filename | cut -f1 -d.` 11 minutes ago" $filename

The cut is needed because getdate (used by touch) uses doesn't
understand microseconds. `info "Date input formats"` is also your
friend :)

HTH,

Bernard.

-- 
 Bernard Blackham 
 bernard at blackham dot com dot au
_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug


More information about the plug mailing list