forked from root/threadr.lostcave.ddnss.de
refined output, fixed indentation
parent
acd98ffb3e
commit
2d107e6234
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/python2
|
||||||
|
|
||||||
print """
|
print """
|
||||||
Variable Grabbler - version 1.4
|
Variable Grabbler - version 1.6
|
||||||
-------------------------------"""
|
-------------------------------"""
|
||||||
|
|
||||||
# definitions
|
# definitions
|
||||||
|
@ -10,17 +10,21 @@ import os, json, fnmatch
|
||||||
dir = os.path.dirname(os.path.abspath(__file__))
|
dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
file_name_pattern = "*.php"
|
file_name_pattern = "*.php"
|
||||||
|
|
||||||
print "Opening config file..."
|
print "Reading config file...",
|
||||||
config = open("variable_grabbler.cfg","r")
|
config = open("variable_grabbler.cfg","r")
|
||||||
parsed = json.load(config)
|
parsed = json.load(config)
|
||||||
config.close()
|
config.close()
|
||||||
|
print "Done."
|
||||||
|
|
||||||
|
print "Working on files:"
|
||||||
for x in parsed:
|
for x in parsed:
|
||||||
|
print "["+x+"]:"
|
||||||
for path, dirs, files in os.walk(dir):
|
for path, dirs, files in os.walk(dir):
|
||||||
for fname in fnmatch.filter(files, file_name_pattern):
|
print path+" >",
|
||||||
file_path = os.path.join(path, fname)
|
for file_name in fnmatch.filter(files, file_name_pattern):
|
||||||
|
file_path = os.path.join(path, file_name)
|
||||||
|
|
||||||
print "Working on file: "+file_path
|
print file_name,
|
||||||
|
|
||||||
file_in = open(file_path, "r")
|
file_in = open(file_path, "r")
|
||||||
file_content = file_in.read()
|
file_content = file_in.read()
|
||||||
|
@ -31,3 +35,4 @@ for x in parsed:
|
||||||
file_out = open(file_path, "w")
|
file_out = open(file_path, "w")
|
||||||
file_out.write(file_content)
|
file_out.write(file_content)
|
||||||
file_out.close()
|
file_out.close()
|
||||||
|
print ""
|
||||||
|
|
Loading…
Reference in New Issue