Skip to content

Instantly share code, notes, and snippets.

@yelizariev
Created February 18, 2019 15:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save yelizariev/dd178a0d5b2b373fbf0d2bbb96a9cc1a to your computer and use it in GitHub Desktop.
Simple file rotating (e.g. for backups)
# based on https://serverfault.com/a/196847
# It will keep only latest 12 files
ls -1t /path/to/dir/* | tail -n +13 | xargs rm > /dev/null 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment