Add search files command

This commit is contained in:
slavakurilyak
2023-04-04 20:32:15 -05:00
parent ed5952782f
commit 1e47328079
3 changed files with 22 additions and 6 deletions

View File

@@ -58,3 +58,16 @@ def delete_file(filename):
return "File deleted successfully."
except Exception as e:
return "Error: " + str(e)
def search_files(directory):
found_files = []
search_directory = safe_join(working_directory, directory)
for root, _, files in os.walk(search_directory):
for file in files:
if file.startswith('.'):
continue
relative_path = os.path.relpath(os.path.join(root, file), working_directory)
found_files.append(relative_path)
return found_files