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

Method search

FTP_controller.py:283–304  ·  view source on GitHub ↗
(self, dir_name, status_command, search_file_name)

Source from the content-addressed store, hash-verified

281 os.chdir('..')
282
283 def search(self, dir_name, status_command, search_file_name):
284 #Go into the ftp directory
285 self.ftp.cwd(dir_name)
286 #Get file lists
287 detailed_file_list = self.get_detailed_file_list()
288 file_list = self.get_file_list(detailed_file_list)
289 for file_name, file_details in zip(file_list, detailed_file_list):
290 #If file_name matches the keyword, append it to search list
291 if search_file_name.lower() in file_name.lower():
292 if(self.ftp.pwd() == '/'):
293 dir = ''
294 else:
295 dir = self.ftp.pwd()
296 self.search_file_list.append(dir+'/'+file_name)
297 self.detailed_search_file_list.append(file_details)
298 status_command(dir+'/'+file_name, 'Found')
299 #If directory, search it
300 if(self.is_dir(file_details)):
301 status_command(file_name, 'Searching directory')
302 self.search(file_name, status_command, search_file_name)
303 #Goto to parent directory
304 self.ftp.cwd('..')
305
306 def clear_search_list(self):
307 del self.search_file_list[:]

Callers 1

search_fileMethod · 0.45

Calls 5

get_file_listMethod · 0.95
is_dirMethod · 0.95
cwdMethod · 0.80
pwdMethod · 0.45

Tested by

no test coverage detected