Advertisement
expired6978

Ex

Jun 14th, 2014
299
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. import sys, os, fnmatch, subprocess, shutil
  2. from collections import defaultdict
  3.  
  4. def findFiles (path, filter):
  5.     for root, dirs, files in os.walk(path):
  6.         for file in fnmatch.filter(files, filter):
  7.             yield os.path.join(root, file)
  8.  
  9.  
  10.  
  11. def main(argv):
  12.     mainDirectory = argv[0]
  13.     outFile = open('extract.txt', 'wt')
  14.  
  15.     print('Deleting object files...')
  16.     for file in findFiles(mainDirectory, '*.obj'):
  17.         os.remove(file)
  18.     print('Deleting text files...')
  19.     for file in findFiles(mainDirectory, '*.txt'):
  20.         os.remove(file)
  21.    
  22.     for file in findFiles(mainDirectory, '*.tri'):
  23.         if file[:-7] != "new.tri": # Ignore generated files
  24.             outFile.write('Extracting ' + file + '\n')
  25.             proc = subprocess.Popen(['TriExtractor.exe', file, '-q'])
  26.             proc.wait()
  27.  
  28. if __name__ == "__main__":
  29.    main(sys.argv[1:])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement