Created
October 14, 2011 16:00
-
-
Save bancek/1287498 to your computer and use it in GitHub Desktop.
Python replace exe files with bat files
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 | |
from glob import glob | |
for file in glob('*-script.py'): | |
exe = file.replace('-script.py', '.exe') | |
bat = file.replace('-script.py', '.bat') | |
ax = filter(os.path.exists, [exe, bat]) | |
print file | |
map(os.remove, ax) | |
with open(bat, 'w') as f: | |
f.write('@python "%s" %%*' % os.path.abspath(file)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment