If you have a directory full of logs for example, I am sure at some point you needed to delete all of them, but the 10 most recent ones. Here is a very short bash one-liner:
rm `ls -t | awk 'NR>10'`
This will remove all the files from the folder and will leave the 10 most recent ones. The command sorts the files by date.