On Tue, 13 Oct 2009, Israel Garcia wrote: > Hi List, > > It's a simple question but difficult to me :-). > > How can I delete all files on a folder /xxxx but keeping only the two > latest (newest) files? > how about something like this to start: for file in $(ls -tA | egrep -v "$(ls -tA |head -n 2)") ; do if [ -f $file ] ; then echo "do a rm of $file" ;fi ; done
-- 8 out of 10 Owners who Expressed a Preference said Their Cats Preferred Techno. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org