On 10/13/09, Jeff D <fixedo...@gmail.com> wrote: > 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 Hi, jeff
Thanks for your answer., but doesn't work either :-( regards, Israel. > > -- > 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 > > -- Regards; Israel Garcia -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org