Skip to content

Instantly share code, notes, and snippets.

@pmcjury
Created December 3, 2014 16:12
Show Gist options
  • Save pmcjury/8f4de88c0eb6fbfa9aaa to your computer and use it in GitHub Desktop.
Save pmcjury/8f4de88c0eb6fbfa9aaa to your computer and use it in GitHub Desktop.
Remove N oldest files from a directory
ls -1tr | head -n -10 | xargs -d '\n' rm -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment