[H-GEN] chestnut

Greg Black gjb at gbch.net
Wed Mar 26 19:13:41 EST 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

Sarah Hollings wrote:

> Anyone know of a simple one-[or-two]-liner (in bash or perl -e) for 
> deleting the oldest file in a directory?

This one will work in /bin/sh or any Bourne-style shell:

    rm `ls -tr | tail -1`

Greg

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list