(self, file_dir, copy_from, file_size, status_command, replace_command)
| 102 | status_command(rename_from, 'Failed to move') |
| 103 | |
| 104 | def copy_file(self, file_dir, copy_from, file_size, status_command, replace_command): |
| 105 | #Change to script's directory |
| 106 | abspath = os.path.abspath(__file__) |
| 107 | dname = os.path.dirname(abspath) |
| 108 | os.chdir(dname) |
| 109 | if not os.path.exists('copy_temps'): |
| 110 | os.makedirs('copy_temps') |
| 111 | os.chdir('copy_temps') |
| 112 | #Save the current path so that we can copy later |
| 113 | dir_path_to_copy = self.ftp.pwd() |
| 114 | #Change to the file's path and download it |
| 115 | self.ftp.cwd(file_dir) |
| 116 | self.download_file(copy_from, file_size, status_command, replace_command) |
| 117 | #Change back to the saved path and upload it |
| 118 | self.ftp.cwd(dir_path_to_copy) |
| 119 | self.upload_file(copy_from, file_size, status_command, replace_command) |
| 120 | #Delete the downloaded file |
| 121 | os.remove(copy_from) |
| 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 |
no test coverage detected