[Wylug-discuss] Copy files by date

Smylers Smylers at stripey.com
Thu Jan 26 08:33:49 UTC 2012


linux at sh2515.plus.com writes:

> The date -v will not work because the version of date is old.

Bah.

What about the variant I gave which used Perl to calculate the date?

If you need to install a Perl module, note you can do that as a normal
user and put it under your home directory; you don't need to be root or
install it system-wide.

> couldn't workout how to cp with xargs. My normal use of copy is cp
> source destination so couldn't think of how cp would work with xargs,

The Gnu cp command (used by Linux) has a -t option, so you can do:

  $ cp -t destination source1 source2 source...

which works nicely with xargs. But yet again that appears to be an
option not in FreeBSD, so presumably not on OS X either.

> However if I understand correctly, please clarify if not, you can use
> anything? Eg xargs -I Fred cp Fred /destination/folder 

Yup, that's right.

Smylers
-- 
http://twitter.com/Smylers2



More information about the Wylug-discuss mailing list