| 464 | self.upload_file(local_path=local_path, remote_path=remote_path, progress=progress) |
| 465 | |
| 466 | def upload_directory(self, remote_path, local_path, progress=None): |
| 467 | |
| 468 | urn = Urn(remote_path, directory=True) |
| 469 | |
| 470 | if not urn.is_dir(): |
| 471 | raise OptionNotValid(name="remote_path", value=remote_path) |
| 472 | |
| 473 | if not os.path.isdir(local_path): |
| 474 | raise OptionNotValid(name="local_path", value=local_path) |
| 475 | |
| 476 | if not os.path.exists(local_path): |
| 477 | raise LocalResourceNotFound(local_path) |
| 478 | |
| 479 | if self.check(urn.path()): |
| 480 | self.clean(urn.path()) |
| 481 | |
| 482 | self.mkdir(remote_path) |
| 483 | |
| 484 | for resource_name in listdir(local_path): |
| 485 | _remote_path = "{parent}{name}".format(parent=urn.path(), name=resource_name) |
| 486 | _local_path = os.path.join(local_path, resource_name) |
| 487 | self.upload(local_path=_local_path, remote_path=_remote_path, progress=progress) |
| 488 | |
| 489 | def upload_file(self, remote_path, local_path, progress=None): |
| 490 | |