Skip to content

Instantly share code, notes, and snippets.

@antlypls
Created June 14, 2011 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save antlypls/1025511 to your computer and use it in GitHub Desktop.
Save antlypls/1025511 to your computer and use it in GitHub Desktop.
This script runs all .py files in all subdirectories
import os
path = os.getcwd()
for root, dirs, files in os.walk(path):
print("visiting: ", root)
os.chdir(root)
py_files = [file for file in files if file[-3:]=='.py']
for py_file in py_files:
cmd = "python {0}".format(py_file)
print("running: ", cmd)
os.system(cmd)
os.chdir(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment