[SOLVED] Delete 10 oldest files

As the heading says, I want to delete the 10 oldest files (according to access time) in a directory. I've tried the following:
but that doesn't work if there is spaces in the filenames.
- Code: Select all
for a in `ls -u|tail`;do rm "$a";done
but that doesn't work if there is spaces in the filenames.