(self, file_dir, copy_from, status_command, replace_command)
| 122 | status_command(copy_from, 'Deleted local file') |
| 123 | |
| 124 | def copy_dir(self, file_dir, copy_from, status_command, replace_command): |
| 125 | #Change to script's directory |
| 126 | abspath = os.path.abspath(__file__) |
| 127 | dname = os.path.dirname(abspath) |
| 128 | os.chdir(dname) |
| 129 | if not os.path.exists('copy_temps'): |
| 130 | os.makedirs('copy_temps') |
| 131 | os.chdir('copy_temps') |
| 132 | #Save the current path so that we can copy later |
| 133 | dir_path_to_copy = self.ftp.pwd() |
| 134 | #Change to the file's path and download it |
| 135 | self.ftp.cwd(file_dir) |
| 136 | self.download_dir(copy_from, status_command, replace_command) |
| 137 | #Change back to the saved path and upload it |
| 138 | self.ftp.cwd(dir_path_to_copy) |
| 139 | self.upload_dir(copy_from, status_command, replace_command) |
| 140 | #Delete the downloaded folder |
| 141 | shutil.rmtree(copy_from) |
| 142 | status_command(copy_from, 'Deleting local directory') |
| 143 | |
| 144 | def delete_file(self, file_name, status_command): |
| 145 | try: |
no test coverage detected