Skip to content

Instantly share code, notes, and snippets.

@amiraliakbari
Created February 6, 2015 13:41
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 amiraliakbari/855834e9f5178df75196 to your computer and use it in GitHub Desktop.
Save amiraliakbari/855834e9f5178df75196 to your computer and use it in GitHub Desktop.
Remove .pyc files in current directory recursively
import os
import subprocess
for dirpath, dirnames, filenames in os.walk(os.getcwd()):
for each_file in filenames:
if each_file.endswith('.pyc'):
if os.path.exists(os.path.join(dirpath, each_file)):
os.remove(os.path.join(dirpath, each_file))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment