need a command to delete all files apart from last file generated

view full story

http://www.unix.com – Hi, I have a directory named (/output). this directory has files in the below format Code: abc.* , xyz*, djj*, iwe*, weewe*, rier*, 3948903ddfgf* these files are generated at random. what i need to do is. delete all the files of all kinds but keep only the last generated file of eachtime. the final result will have only 1 type of file for each of the files present in the folder. the file that will be present will be the latest file. (HowTos)