Date: Tue, 24 Aug 2004 17:15:10 -0600 From: Nathan Kinkade <nkinkade@ub.edu.bz> To: Joachim Dagerot <freebsd@dagerot.nu> Cc: freebsd-questions@freebsd.org Subject: Re: Bash programming, copy only onefile? Message-ID: <20040824231510.GS3767@gentoo-npk.bmp.ub> In-Reply-To: <200408242216.i7OMGIp05050@thunder.trej.net> References: <000001c489ff$1ab67f10$4b592650@yd5esbzvskxjc0a> <200408242216.i7OMGIp05050@thunder.trej.net>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
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
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFBK8v+O0ZIEthSfkkRAhckAKCJq6MBVaXPZRwRqlHiJALrfgn8wwCfao1D
SgyiiE/kMq7HM4CaiPrzhQo=
=ktMc
-----END PGP SIGNATURE-----
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040824231510.GS3767>
