Skip to content

Instantly share code, notes, and snippets.

@ThevenRexOff
Forked from technocake/pyclean.sh
Created February 20, 2024 01:56
Show Gist options
  • Save ThevenRexOff/b512541add1fa94097801d90043eda45 to your computer and use it in GitHub Desktop.
Save ThevenRexOff/b512541add1fa94097801d90043eda45 to your computer and use it in GitHub Desktop.
Clear all python cache in directory
# pyclean command to clear all python cache in a directory
# source: https://stackoverflow.com/questions/28991015/python3-project-remove-pycache-folders-and-pyc-files
# in .bash_profile / .bash_rc etc put:
pyclean () {
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
}
# Now to delete all python cache in a directory do:
cd path/to/directory
pyclean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment