Linux
Delete everything but last 20 files:
ls -tp <FILEMASK> | grep -v ‘/$’ | tail -n +20 | xargs -d ‘\n’ rm —
Delete files older than 10 days:
find ./<DIR> -mtime +10 -type f -delete
0 comments
Personal Thoughts and Ramblings
Delete everything but last 20 files:
ls -tp <FILEMASK> | grep -v ‘/$’ | tail -n +20 | xargs -d ‘\n’ rm —
Delete files older than 10 days:
find ./<DIR> -mtime +10 -type f -delete
0 comments