Created
January 29, 2018 08:51
-
-
Save shirishp/cd73c865ea7fb24134853ed978985d74 to your computer and use it in GitHub Desktop.
Each in Python
This file contains hidden or 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
#!/usr/bin/env python | |
import os | |
import sys | |
from subprocess import call | |
rootdir = os.getcwd(); | |
command = sys.argv[1:] | |
files = [f for f in os.listdir('.') if os.path.isdir(f)] | |
for f in files: | |
print '\033[92m', 'Working in directory', f, '\033[0m' | |
os.chdir(os.path.join(rootdir, f)) | |
call(command) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment