MCPcopy Create free account
hub / github.com/RainingComputers/whipFTP / copy_dir

Method copy_dir

FTP_controller.py:124–142  ·  view source on GitHub ↗
(self, file_dir, copy_from, status_command, replace_command)

Source from the content-addressed store, hash-verified

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:

Callers 1

clipboard_pasteMethod · 0.45

Calls 4

download_dirMethod · 0.95
upload_dirMethod · 0.95
cwdMethod · 0.80
pwdMethod · 0.45

Tested by

no test coverage detected