Skip to content

Instantly share code, notes, and snippets.

@chrischambers
Created July 28, 2010 13:57
Show Gist options
  • Save chrischambers/494601 to your computer and use it in GitHub Desktop.
Save chrischambers/494601 to your computer and use it in GitHub Desktop.
cleanup () {
find ./ -name '*~' -or -name '*.pyc' -or -name '#*#' -or -name '.*~' -or -name '.#*' | xargs rm -f
clear
}
# The previous cleanup function is potentially dangerous in an environment where you could have filenames with spaces.
# The safest pattern when using the find... xargs combo is to use null-terminators for filenames, i.e.
`find ... -print0 | xargs -0 ...`:
cleanup () {
find . -type f -name '*~' -or -name '*.pyc' -or -name '#*#' -or -name '.*~' -or -name '.#*' -print0 | xargs -0 rm -f
clear
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment