ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/ImgDir_Cat_ForCLM.py
Revision: 8
Committed: Sat May 5 04:21:19 2012 UTC (13 years, 10 months ago) by ninoborges
Content type: text/x-python
File size: 1676 byte(s)
Log Message:
Initial Import

File Contents

# User Rev Content
1 ninoborges 8 """
2     ImgDir_Cat_ForCLM
3    
4     Created by
5     Emanuel Borges
6     09.10.2010
7    
8     This program will do a cat similar to sum_imgdir_cat but it will only look for a specific client matter and,
9     like gather_ImgSir_Sizes, it will only search on a list of gathered possible C_D dirs.
10    
11    
12     """
13    
14     import Sum_imgdir_cat,os,NinoGenTools
15    
16     def CatThisFolder(folder, outputDir, outputNameCounter):
17     """This method will cat the contents of this particular folder to a file in the outputDir. This should
18     probably be moved to a tool box"""
19     outputNameCounter.inc()
20     outputFile = open(os.path.join(outputDir,'%s.txt'%outputNameCounter.count),'w')
21     for root, dirs, files in os.walk(folder):
22     for file in files:
23     outputFile.write(os.path.join(root,file)+"\n")
24     outputFile.close()
25    
26     if __name__ == '__main__':
27     outputNameCounter = NinoGenTools.Counter()
28     clientMatter = "281120014"
29     possibleimgDirs = open(r"\\lisdisdss01\ercdis12\Admin\Share\Manny\APP\C_D_MasterList.txt").readlines()
30     outputDir = r"\\lisdisdss01\ercdis12\Admin\Share\Manny\%s"%clientMatter
31     for location in possibleimgDirs:
32     print "Now looking for %s on %s"% (clientMatter,location)
33     location = location.replace("\n","")
34     for folder in os.listdir(location):
35     if folder == clientMatter:
36     print "Your client matter was found. Now scanning folder..."
37     CatThisFolder(os.path.join(location,folder), outputDir, outputNameCounter)
38     print "Folder scanned and written. Moving on. \n\n"
39     else:
40     print "Your client matter was NOT found in this location. Moving on.\n\n"