[Wylug-discuss] Copy files by date
linux at sh2515.plus.com
linux at sh2515.plus.com
Wed Jan 25 22:05:33 UTC 2012
> linux at sh2515.plus.com writes:
>
>
>> 1st thanks all for replying.
>>
>> [Aaron Crane writes]:
>>
>> > Smylers <Smylers at stripey.com> wrote:
>> >
>> > > FreeBSD's date command doesn't have --date
>> >
>> > True. But there's a workaround in this case:
>> >
>> > $ /bin/date -v -1d +'%F'
>> > 2012-01-24
>>
>> 2nd how would I use this code against a file date?
>
> Exactly as the command I gave earlier which finds files newer than the
> start of today, but substituting Aaron's date command from above which
> gives yesterday's date instead.
So the date would be put in as a command through -newermt as you - quite
rightly - said earlier? I do apologise for being slightly ignorant to the
e-mails specifically on date, I thought people where going off on a
tangent talking about how macs use date. My knowledge of bash scripting
is quite limited to simpler multimedia commands eg ffmpeg, imagemagik etc.
so, would the following script be correct?
find . -iname "*.txt" -newermt $(date -v -1d +'%F') | xargs -I % cp -r %
~/test/
Scott
More information about the Wylug-discuss
mailing list