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

Method delete_dir

FTP_controller.py:151–171  ·  view source on GitHub ↗
(self, dir_name, status_command)

Source from the content-addressed store, hash-verified

149 status_command(file_name, 'Failed to delete')
150
151 def delete_dir(self, dir_name, status_command):
152 #Go into the directory
153 self.ftp.cwd(dir_name)
154 #Get file lists
155 detailed_file_list = self.get_detailed_file_list(True)
156 file_list = self.get_file_list(detailed_file_list)
157 for file_name, file_details in zip(file_list, detailed_file_list):
158 #If directory
159 if(self.is_dir(file_details)):
160 self.delete_dir(file_name, status_command)
161 #If file
162 else:
163 self.delete_file(file_name, status_command)
164 #Go back to parent directory and delete it
165 try:
166 self.ftp.cwd('..')
167 status_command(dir_name, 'Deleting directory')
168 self.ftp.sendcmd('RMD '+dir_name)
169 except:
170 status_command(dir_name, 'Failed to delete directory')
171 return
172
173 def upload_file(self, file_name, file_size, status_command, replace_command):
174 def update_progress(data):

Callers 2

move_dirMethod · 0.95
delete_itemMethod · 0.45

Calls 5

get_file_listMethod · 0.95
is_dirMethod · 0.95
delete_fileMethod · 0.95
cwdMethod · 0.80

Tested by

no test coverage detected