Copies a directory from source to target.
(source, target, allow_overwrite=False)
| 216 | |
| 217 | |
| 218 | def copy_directory(source, target, allow_overwrite=False): |
| 219 | """ Copies a directory from source to target. """ |
| 220 | if not options.dryrun and os.path.exists(target): |
| 221 | if not allow_overwrite: |
| 222 | raise Exception("Directory %s already exists" % (target)) |
| 223 | remove_directory(target) |
| 224 | if os.path.exists(source): |
| 225 | msg("Copying directory %s to %s" % (source, target)) |
| 226 | if not options.dryrun: |
| 227 | shutil.copytree(source, target) |
| 228 | |
| 229 | |
| 230 | def move_directory(source, target, allow_overwrite=False): |