[Wylug-discuss] Copy files by date
Aaron Crane
arc at aaroncrane.co.uk
Wed Jan 25 14:44:41 UTC 2012
Smylers <Smylers at stripey.com> wrote:
> FreeBSD's date command doesn't have --date, so I suspect OS X's doesn't
> either, unfortunately.
True. But there's a workaround in this case:
$ /usr/bin/uname -sr
Darwin 10.8.0
$ /bin/date
Wed 25 Jan 2012 14:38:44 GMT
$ /bin/date -v -1d +'%F'
2012-01-24
The -v option to date(1) in FreeBSD and Mac OS X takes an "adjustment"
to apply to the date before printing it; in this case, we adjust by
subtracting one day ("-1d"). Then the %F date format shows just the
date, as desired.
> Maybe simply installing Gnu tools would be the best way round this?
Yes, often.
--
Aaron Crane ** http://aaroncrane.co.uk/
More information about the Wylug-discuss
mailing list