manipulating/testing file times.

Dan Fandrich dan at coneharvesters.com
Fri Nov 26 21:36:57 UTC 2010


On Fri, Nov 26, 2010 at 12:29:27PM +0100, Denys Vlasenko wrote:
> On Fri, Nov 26, 2010 at 11:00 AM, David Collier
> > Can anyone tell me if there is anything around as standard that might
> > allow me to do the equivalent of
> >
> > touch /tmp/fred "+3days"
> 
> plus3days=$(date '+%Y-%m-%d %H:%M:%S' -D '%s' -d $((`date '+%s'` +
> 3*24*60*60)) )
> touch -d "$plus3days" FILE
> 
> Note that date -D is a busybox extension.

coreutils' touch actually allows relative dates and times:

  touch -d "+3 days" FILE

does what you would expect. That's a potential enhancement to Busybox.

>>> Dan


More information about the busybox mailing list