Last active
March 16, 2017 14:38
-
-
Save danmaps/3386633ff031bd95fae9bd6a982fad88 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 glob, os | |
def batchfile(script_folder, batchfile_folder, pyexe): | |
os.chdir(script_folder) | |
for file in glob.glob("*.py"): | |
script = os.path.splitext(file)[0] | |
batch = batchfile_folder+script+".bat" | |
with open(batch, 'w+') as f: | |
print batch | |
f.write("echo executing with "+pyexe+"\n") | |
f.write(pyexe+" "+os.path.abspath(file)) | |
print "complete" | |
if __name__ == '__main__': | |
batchfile(r"path2scripts", r"path2bats",r"path2pyexe") | |
#batchfile(r"C:/scripts", r"C:/scripts/batchfiles/", "C:\Python27\ArcGIS10.5\python.exe") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment