[Wylug-discuss] Copy files by date

Peter Nix peter at pjnix.org
Wed Jan 25 11:15:15 UTC 2012


On 25 Jan 2012, at 11:54CET, Smylers wrote:

> Towle, William writes:
> 
>>> running date with the %F format just gives the date without a time,
>>> so is interpreted as the start of today. But you still need a way of
>>> passing yesterday's date to the date command
>> 
>>  If it's available, the '--date' argument will happily calculate relative
>> times suitably.
> 
> FreeBSD's date command doesn't have --date, so I suspect OS X's doesn't
> either, unfortunately.
> 
> Maybe simply installing Gnu tools would be the best way round this?
> 
> Smylers

macos find has
     -newer somefile
             True if the current file has a more recent last modification time than somefile.


I recollect a messy workaround that involves the script  touching  somefile to yesterday midnight and then using it as the  -newer comparator




More information about the Wylug-discuss mailing list