Skip to content

Instantly share code, notes, and snippets.

@damianobarbati
Created November 17, 2020 14:09
Show Gist options
  • Save damianobarbati/2c0a7db4880160b805d3a7c87f2c49ff to your computer and use it in GitHub Desktop.
Save damianobarbati/2c0a7db4880160b805d3a7c87f2c49ff to your computer and use it in GitHub Desktop.
find + rm
find /var/log/ -maxdepth 1 -type f -iwholename '*[^a-z0-9\-\_\.\/]*' -print0 | xargs -r -0 rm
find /var/log/ -maxdepth 1 -type f -not -iname '*_*' -print0 | xargs -r -0 rm
find /var/log/ -maxdepth 1 -type f -not -name '*_*.log*' -delete
find /var/log/ -maxdepth 1 -type f -name '*.php*' -delete
find /var/log/ -maxdepth 1 -type f -name '*.html*' -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment