Created
March 21, 2012 14:27
-
-
Save davidmcclure/2147386 to your computer and use it in GitHub Desktop.
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, sys | |
for subdir, dirs, files in os.walk(sys.argv[1]): | |
print subdir | |
for file in files: | |
print file | |
f = open(subdir+'/'+file, 'r') | |
lines = f.readlines() | |
f.close() | |
f = open(subdir+'/'+file, 'w') | |
for line in lines: | |
newline = line.replace(sys.argv[2], sys.argv[3]) | |
f.write(newline) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment