Remove all .pyc files from a directory
In the terminal, navigate to your folder and type the following command to remove all pyc files from that directory and its subdirectories:
find . -name "*.pyc" -exec rm -rf {} \;
Also on Ubuntu, you can try pyclean (comes pre-installed):
http://manpages.ubuntu.com/manpages/precise/man1/pyclean.1.html
Written by Nahim Nasser
Related protips
2 Responses
Good catch on the nomenclature ---
A recursive removal will clear up any .pyc files in subdirectories.
over 1 year ago
·
Deleting with find
is common, so there's a shortcut:
find . -name "*.pyc" -delete
I will have to check out pyclean
. Thanks for the tip.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#