Monday, July 30, 2012

Bash: Delete oldest 5 files in a directory

After a bit of searching, I found quite a few options.  This was simple and got the job done.


find /directoryName -type f | awk 'NR>5'|xargs rm -f

No comments:

Post a Comment