ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/Summation/Summation Extension/Sum_Ext_FileVerify.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: 1550 byte(s)
Log Message:
Initial Import

File Contents

# User Rev Content
1 ninoborges 8 """
2     Version .05 (UNSTABLE)
3     Created by Emanuel Borges
4     2.06.06
5    
6     This is a simple program that will eventually be added as a tool to Summation Extension.
7     It will read the CopySucess.log file and verify each one of the images to make sure they
8     exist. This will be useful when you are looking for broken images in the DB.
9    
10     DEPENDS:
11     - os
12    
13     NOTES:
14     - Add this to tools, right under Process.
15     - They must GetProjectScope first! Or there wont be a CopySucess.log file to process.
16    
17     """
18    
19     import os
20    
21     def CheckFile(fileAndPathList, workFile):
22     """CheckFile(fileAndPathList = list of files & paths to check, workFile = an error log
23     to save the ones not found)
24     This is the main method that will check the files"""
25     print "verifying %s files for existance. Please wait..."% len(fileAndPathList)
26     foundCount = 0
27     notFoundCount = 0
28     output = open(workFile,'w')
29     for path in fileAndPathList:
30     if os.path.isfile(path.replace("\n","")):
31     foundCount = foundCount + 1
32     else:
33     notFoundCount = notFoundCount +1
34     output.write("%s was not found\n"%path.replace("\n",""))
35     output.close()
36     print "Verification complete!"
37    
38    
39     if __name__ == "__main__":
40     fileAndPathList = open(r"C:\Program Files\Practice Support\Summation Extension\Projects\CSX_Universe_2-6-06\copySuccess.log").readlines()
41     workFile = r"C:\Program Files\Practice Support\Summation Extension\Projects\CSX_Universe_2-6-06\VerificationErrors.log"
42     CheckFile(fileAndPathList, workFile)