Changeset 7761 for ndgCommon


Ignore:
Timestamp:
02/12/10 12:18:11 (9 years ago)
Author:
sdonegan
Message:

includes extra method for copying files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/lib/fileutilities.py

    r5246 r7761  
    116116         
    117117    logging.info("Backup completed successfully") 
     118     
    118119 
     120def copyFileToDir(original_file, destination_dir): 
     121    ''' 
     122    Copy contents of file to  new dir 
     123    @param original_file: file to copy 
     124    @param destination_dir: dir to copy it to   
     125    ''' 
     126    logging.info("Copying file (" + original_file + \ 
     127                            " --> " + destination_dir + ")") 
     128    makepath(destination_dir) 
     129 
     130    commandline = "cp " + original_file + " " + destination_dir 
     131    logging.info("Executing : " + commandline) 
     132    status = os.system(commandline) 
     133    if status !=0: 
     134        sys.exit("Failed at copying to new directory %s" %destination_dir) 
     135         
     136    logging.info("Copy completed successfully") 
     137 
     138     
     139 
Note: See TracChangeset for help on using the changeset viewer.