Advertisement
Guest User

Nayuta .arb copier

a guest
Feb 10th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import os
  2. import struct
  3.  
  4. def get_data(filename):
  5.     totalbytes = os.path.getsize(filename)
  6.     infile = open(filename, 'rb')
  7.     totalfiledata = infile.read(totalbytes)
  8.     infile.close()
  9.     return totalfiledata
  10.  
  11. mypath = os.path.dirname(os.path.realpath(__file__))
  12. filelist = []
  13. for dirName, subdirList, fileList in os.walk(mypath):
  14.     filelist.extend([dirName + '\\' + f for f in fileList if os.path.splitext(f)[1] == '.arb'])
  15.  
  16. output = []
  17. for f in filelist:
  18.     filedata = get_data(f)
  19.     f = os.path.splitext(os.path.basename(f))[0] + '.orig'
  20.     outfile = open(f,'wb')
  21.     outfile.write(filedata)
  22.     outfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement