test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
copyFiles.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 import sys,os,commands
3 from CommonMethods import *
4 
5 def main():
6  if len(sys.argv) < 3:
7  error = "Usage: copyFiles.py fromDir destDir (optional filter)"
8  exit(error)
9  fromDir = sys.argv[1]
10  print fromDir
11  if (fromDir[len(fromDir)-1] != '/'):
12  fromDir += '/'
13  destDir = sys.argv[2] + "/"
14  filter = ""
15  if len(sys.argv) > 3:
16  filter = sys.argv[3]
17  fileList = ls(fromDir,filter)
18  copiedFiles = cp(fromDir,destDir,fileList)
19 
20  if len(copiedFiles) != len(fileList):
21  error = "ERROR: I couldn't copy all files from " + fromDir
22  exit(error)
23 
24 if __name__ == "__main__":
25  main()
def main
Definition: copyFiles.py:5
Definition: main.py:1