ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/NativesToDataLoad.py
Revision: 449
Committed: Tue Sep 10 20:40:18 2013 UTC (12 years, 6 months ago) by nino.borges
Content type: text/x-python
File size: 1231 byte(s)
Log Message:
A simple app that will let me add natives with load files to a review tool.

File Contents

# Content
1 """
2 NativesToDataLoad
3
4 Created by
5 Emanuel Borges
6 08.25.13
7
8 This program will create a simple data load from a dir, with sub dirs, of native files. It will
9 even grab things like the modified data and will support docIDs.
10
11 """
12
13 import os, time, NinoGenTools
14
15 def MakeNewDat(startDir):
16 outputFile = open(os.path.join(startDir,"NativeDataLoad.dat"),'w')
17 outputFile.write("DocID|FileName|CreateDate|FileExt|NativeFile\n")
18 return outputFile
19
20 def AddToDat(outputFileObj,docID,fileName,createdDate,fileExt,fileAndPath):
21 outputFileObj.write(docID +"|"+ fileName+"|"+createdDate+"|"+fileExt+"|"+fileAndPath+"\n")
22
23 if __name__ == '__main__':
24 startDir = r"W:\Manny\Client\054265-0531"
25 batesPrefix = "Inv_FF-"
26 batesPadding =9
27 batesStartN0 =1
28 counterObject = NinoGenTools.Counter()
29 outputFileObj = MakeNewDat(startDir)
30 flProps = NinoGenTools.FileProperties()
31
32 for root, dirs, files in os.walk(startDir):
33 for f in files:
34 AddToDat(outputFileObj,batesPrefix + "%0*d"% (batesPadding,counterObject.count),f,flProps.GetCreatedDate(os.path.join(root,f)),os.path.splitext(f)[1],os.path.join(root,f))
35 counterObject.inc(1)
36