Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-10-27 04:18:16

0001 #!/usr/bin/env python3
0002 from __future__ import print_function
0003 import sys,os
0004 from CommonMethods import *
0005 
0006 def main():
0007     if len(sys.argv) < 3:
0008         error = "Usage: copyFiles.py fromDir destDir (optional filter)"
0009         exit(error)
0010     fromDir = sys.argv[1]
0011     print(fromDir)
0012     if (fromDir[len(fromDir)-1] != '/'):
0013         fromDir += '/'
0014     destDir = sys.argv[2] + "/"
0015     filter = ""
0016     if len(sys.argv) > 3:
0017         filter = sys.argv[3]
0018     fileList = ls(fromDir,filter)
0019     copiedFiles = cp(fromDir,destDir,fileList)
0020 
0021     if len(copiedFiles) != len(fileList):
0022         error = "ERROR: I couldn't copy all files from " + fromDir
0023         exit(error)
0024         
0025 if __name__ == "__main__":
0026     main()