Created
February 18, 2019 15:07
-
-
Save yelizariev/dd178a0d5b2b373fbf0d2bbb96a9cc1a to your computer and use it in GitHub Desktop.
Simple file rotating (e.g. for backups)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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