Skip site navigation (1)Skip section navigation (2)
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--ZaW/dtY/7oMe/vLp
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 25, 2004 at 12:16:17AM +0200, Joachim Dagerot wrote:
> A quiz easy to write, hard to answer?
>=20
> 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
--=20
PGP Public Key: pgp.mit.edu:11371/pks/lookup?op=3Dget&search=3D0xD8527E49

--ZaW/dtY/7oMe/vLp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBK8v+O0ZIEthSfkkRAhckAKCJq6MBVaXPZRwRqlHiJALrfgn8wwCfao1D
SgyiiE/kMq7HM4CaiPrzhQo=
=ktMc
-----END PGP SIGNATURE-----

--ZaW/dtY/7oMe/vLp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040824231510.GS3767>