manipulating/testing file times.

David Collier from_busybox_maillist at dexdyne.com
Sat Nov 27 01:10:00 UTC 2010


 plus3days=$( date '+%Y-%m-%d %H:%M:%S' 
                    -D '%s' 
                    -d $((`date '+%s'` +  3*24*60*60)) 
            )
            
Aha  - I didn't know you could get date to just chuck out "seconds since
epoch"

so
 1. get seconds since epoch, add seconds as desired
 2. tell dat you will be giving it a time in "seconds since epoch" format
 3. ask for a date string in a format suitable for touch
           
lovely - thank you!

I wish I was clever...

> touch -d "$plus3days" FILE
 
> Note that date -D is a busybox extension.

David


More information about the busybox mailing list