Created
June 14, 2011 18:22
-
-
Save antlypls/1025511 to your computer and use it in GitHub Desktop.
This script runs all .py files in all subdirectories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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