Bash programming, copy only onefile?

Nathan Kinkade nkinkade at ub.edu.bz
Tue Aug 24 16:16:32 PDT 2004


On Wed, Aug 25, 2004 at 12:16:17AM +0200, Joachim Dagerot wrote:
> A quiz easy to write, hard to answer?
> 
> In bash, how can I write a command that moves the oldest file in a
> directory to a new direction?

Here is one possible way, certainly there are many others:

# ls -t /path/to/dir | tail -n 1 | xargs -i{} cp {} /path/to/location

Nathan
-- 
PGP Public Key: pgp.mit.edu:11371/pks/lookup?op=get&search=0xD8527E49
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040824/d1a9c6a1/attachment.bin


More information about the freebsd-questions mailing list