copy local folders Args: fromPath (str): local from path to copy all files under toPath (str): local destination folder (will be created if does not exist)
(self,fromPath,toPath)
| 131 | # |
| 132 | |
| 133 | def copy_local(self,fromPath,toPath): |
| 134 | """copy local folders |
| 135 | |
| 136 | Args: |
| 137 | fromPath (str): local from path to copy all files under |
| 138 | toPath (str): local destination folder (will be created if does not exist) |
| 139 | """ |
| 140 | logger.info("copy %s to %s",fromPath,toPath) |
| 141 | if os.path.isfile(fromPath): |
| 142 | dir = os.path.dirname(toPath) |
| 143 | if len(dir) > 0 and not os.path.exists(dir): |
| 144 | os.makedirs(dir) |
| 145 | copyfile(fromPath,toPath) |
| 146 | elif os.path.isdir(fromPath): |
| 147 | if not os.path.exists(toPath): |
| 148 | os.makedirs(toPath) |
| 149 | for f in glob.glob(fromPath+"/*"): |
| 150 | basename = os.path.basename(f) |
| 151 | fnew = toPath+"/"+basename |
| 152 | logger.info("copying %s to %s",f,fnew) |
| 153 | copyfile(f,fnew) |
| 154 | |
| 155 | |
| 156 | def copy_s3_file(self,fromPath,bucket,path): |