00001 import os 00002 00003 __copyright__ = """\ 00004 (c). Copyright 1990-2008, Vyper Logix Corp., All Rights Reserved. 00005 00006 Published under Creative Commons License 00007 (http://creativecommons.org/licenses/by-nc/3.0/) 00008 restricted to non-commercial educational use only., 00009 00010 See also: http://www.VyperLogix.com and http://www.pypi.info for details. 00011 00012 THE AUTHOR VYPER LOGIX CORP DISCLAIMS ALL WARRANTIES WITH REGARD TO 00013 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 00014 FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00015 INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00016 FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00017 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00018 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! 00019 00020 USE AT YOUR OWN RISK. 00021 """ 00022 00023 def deleteFile(root,fname): 00024 os.remove(os.path.join(root, fname)) 00025 00026 def processAllFilesUnder(top,action=None,tag=''): 00027 try: 00028 for root, dirs, files in os.walk(top, topdown=False): 00029 if (str(action.__class__).find("'function'") > -1): 00030 try: 00031 action(root,dirs,files,tag) 00032 except Exception, details: 00033 print '(processAllFilesUnder) :: ERROR.2 :: (%s).' % (str(details)) 00034 except Exception, details: 00035 print '(processAllFilesUnder) :: ERROR.1 :: (%s).' % (str(details)) 00036 00037 def copyOSFileFromTo(source,dest): 00038 try: 00039 print 'CMD /K XCOPY "%s" "%s" /V' % (source,dest) 00040 #os.system() 00041 except: 00042 pass 00043 00044 def copyAllFilesUnderTo(source,target,action=None): 00045 try: 00046 for root, dirs, files in os.walk(source, topdown=True): 00047 for f in files: 00048 mask = root.replace(source,'') 00049 srcFName = root+os.sep+f 00050 dstFName = target+os.sep+mask+os.sep+f 00051 if (str(action.__class__).find("'function'") > -1): 00052 try: 00053 action(srcFName,dstFName) 00054 except Exception, details: 00055 print '(copyAllFilesUnderTo) :: ERROR.2 :: (%s).' % (str(details)) 00056 else: 00057 copyOSFileFromTo(srcFName,dstFName) 00058 except Exception, details: 00059 print '(copyAllFilesUnderTo) :: ERROR.1 :: (%s).' % (str(details)) 00060 00061 if (__name__ == '__main__'): 00062 import sys 00063 print >>sys.stdout, __copyright__ 00064 print >>sys.stderr, __copyright__ 00065 00066
© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved; If you reference this document or any part of this document you must use the citation verbatim (including the link) "© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved."
Notice: This source code contained in this document is NOT open source and is NOT being distributed as open source.
122,241 lines of code and growing...