From owner-freebsd-questions@FreeBSD.ORG Tue Aug 24 23:16:32 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B4D116A4CE for ; Tue, 24 Aug 2004 23:16:32 +0000 (GMT) Received: from frontend1.messagingengine.com (frontend1.messagingengine.com [66.111.4.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A4C343D46 for ; Tue, 24 Aug 2004 23:16:32 +0000 (GMT) (envelope-from nkinkade@fastmail.fm) X-Sasl-enc: N7n9MYojV05QSrb9Gu0PXA 1093389389 Received: from gentoo-npk.bmp.ub (unknown [206.27.244.136]) by www.fastmail.fm (Postfix) with ESMTP id 74130C14E30; Tue, 24 Aug 2004 19:16:29 -0400 (EDT) Received: from nkinkade by gentoo-npk.bmp.ub with local (Exim 4.21) id 1BzkVS-0007zk-RU; Tue, 24 Aug 2004 17:15:10 -0600 Date: Tue, 24 Aug 2004 17:15:10 -0600 From: Nathan Kinkade To: Joachim Dagerot Message-ID: <20040824231510.GS3767@gentoo-npk.bmp.ub> Mail-Followup-To: Joachim Dagerot , freebsd-questions@freebsd.org References: <000001c489ff$1ab67f10$4b592650@yd5esbzvskxjc0a> <200408242216.i7OMGIp05050@thunder.trej.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ZaW/dtY/7oMe/vLp" Content-Disposition: inline In-Reply-To: <200408242216.i7OMGIp05050@thunder.trej.net> User-Agent: Mutt/1.5.6i Sender: cc: freebsd-questions@freebsd.org Subject: Re: Bash programming, copy only onefile? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Nathan Kinkade List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2004 23:16:32 -0000 --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--