On 10/13/09, Jeff D <[email protected]> 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
Oooppss, it worked! ...Sorry man for my previous mail...thanks :-) regards, Israel. >d > -- > 8 out of 10 Owners who Expressed a Preference said Their Cats Preferred > Techno. > > > -- > To UNSUBSCRIBE, email to [email protected] > with a subject of "unsubscribe". Trouble? Contact > [email protected] > > -- Regards; Israel Garcia -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

