| 1 |
ninoborges |
8 |
"""
|
| 2 |
|
|
|
| 3 |
|
|
DirToDat
|
| 4 |
|
|
|
| 5 |
|
|
This program will take a dii created by DirToDii and export a comma separated DAT file.
|
| 6 |
|
|
|
| 7 |
|
|
Created by
|
| 8 |
|
|
Emanuel Borges
|
| 9 |
|
|
10.27.2007
|
| 10 |
|
|
|
| 11 |
|
|
"""
|
| 12 |
|
|
|
| 13 |
|
|
if __name__ == '__main__':
|
| 14 |
|
|
fileName = "6th_Prod_05-21-2007"
|
| 15 |
|
|
contents = open(r"\\ercdis12\k\C_D\30790270\20071101\6th_Prod_05-21-2007\%s.DII"% fileName).readlines()
|
| 16 |
|
|
outputFile = open(r"c:\test_dir\DELPHI\%s.DAT"% fileName,'w')
|
| 17 |
|
|
endDoc = ""
|
| 18 |
|
|
pageCount = ""
|
| 19 |
|
|
for line in contents:
|
| 20 |
|
|
if line[:10] == "@C EndDoc#":
|
| 21 |
|
|
endDoc = line.split("EndDoc# ")[1]
|
| 22 |
|
|
elif line[:10] == "@C Pgcount":
|
| 23 |
|
|
pageCount = line.split("@C Pgcount ")[1]
|
| 24 |
|
|
elif line[:2] == "@T":
|
| 25 |
|
|
bates = line.split("@T ")[1]
|
| 26 |
|
|
outputFile.write(bates.strip("\n") + "," +endDoc.strip("\n") + "," +pageCount.strip("\n") + "," + fileName +"\n")
|
| 27 |
|
|
outputFile.close()
|