Skip to content

Instantly share code, notes, and snippets.

@shirishp
Created January 29, 2018 08:51
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 shirishp/cd73c865ea7fb24134853ed978985d74 to your computer and use it in GitHub Desktop.
Save shirishp/cd73c865ea7fb24134853ed978985d74 to your computer and use it in GitHub Desktop.
Each in Python
#!/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