Skip to content

Instantly share code, notes, and snippets.

@stav
Created May 15, 2016 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stav/10875bfd57bf2a7f5125aa46900cba88 to your computer and use it in GitHub Desktop.
Save stav/10875bfd57bf2a7f5125aa46900cba88 to your computer and use it in GitHub Desktop.
Remove Python bytecodes and deployment cache
#!/bin/bash
if [ -n "$1" ]; then
TARGET="$1"
else
TARGET="."
fi
# Remove Python compiled bytecode files
command="find $TARGET -name '*.pyc' -type f -delete -print 2>/dev/null";
eval "$command";
# Remove python cache dirs
command="find $TARGET -name __pycache__ -type d -delete -print";
eval "$command";
# Remove dist dirs
command="find $TARGET -name dist -type d -print -exec rm -rf '{}' \;";
eval "$command";
# Remove build dirs
command="find $TARGET -name build -type d -print -exec rm -rf '{}' \;";
eval "$command";
# Remove build dirs created by Sphinx-doc
command="find $TARGET -name _build -type d -print -exec rm -rf '{}' \;";
eval "$command";
# Remove egg stuff
command="find $TARGET -name '*.egg-info' -type d -exec rm -rf '{}' \;";
eval "$command";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment