CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoVertex/BeamSpotProducer/scripts/copyFromCastor.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import sys,os,commands
00003 from CommonMethods import *
00004 def main():
00005     if len(sys.argv) < 3:
00006         error = "Usage: cpFromCastor fromDir toDir (optional filter)"
00007         exit(error)
00008     user = os.getenv("USER")
00009     castorDir = "/castor/cern.ch/cms/store/caf/user/" + user + "/" + sys.argv[1] + "/"
00010     filter = ""
00011     if len(sys.argv) > 3:
00012         filter = sys.argv[3]
00013     fileList = ls(castorDir,filter)
00014     destDir = sys.argv[2]
00015     copiedFiles = cp(castorDir,destDir,fileList)
00016 
00017     if len(copiedFiles) != len(fileList):
00018         error = "ERROR: I couldn't copy all files from castor"
00019         exit(error)
00020         
00021 if __name__ == "__main__":
00022     main()