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 import sys,os
0003 from CommonMethods import *
0004 def main():
0005     if len(sys.argv) < 3:
0006         error = "Usage: cpFromCastor fromDir toDir (optional filter)"
0007         exit(error)
0008     user = os.getenv("USER")
0009     castorDir = "/castor/cern.ch/cms/store/caf/user/" + user + "/" + sys.argv[1] + "/"
0010     filter = ""
0011     if len(sys.argv) > 3:
0012         filter = sys.argv[3]
0013     fileList = ls(castorDir,filter)
0014     destDir = sys.argv[2]
0015     copiedFiles = cp(castorDir,destDir,fileList)
0016 
0017     if len(copiedFiles) != len(fileList):
0018         error = "ERROR: I couldn't copy all files from castor"
0019         exit(error)
0020         
0021 if __name__ == "__main__":
0022     main()