Skip to content

Instantly share code, notes, and snippets.

@yelizariev
Created Feb 18, 2019
Embed
What would you like to do?
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