From b23b774c22759acbeeaf047bbeca40ab60066d94 Mon Sep 17 00:00:00 2001 From: jonnybravo Date: Mon, 22 May 2023 20:00:01 +0200 Subject: [PATCH] commit message from python script --- play_with_os/os_play.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 play_with_os/os_play.py diff --git a/play_with_os/os_play.py b/play_with_os/os_play.py new file mode 100644 index 0000000..9ba95c9 --- /dev/null +++ b/play_with_os/os_play.py @@ -0,0 +1,35 @@ +#! /usr/bin/env python3.10 + +import os + +def show_all_files_directory(dir_path = str, search_endung = False, search_string = False): + li_all = [] + for root_folder, dirs, files in os.walk(dir_path, topdown=False): + for name in files: + FullPATH = str(os.path.join(root_folder, name)) + if not search_endung is False: + if FullPATH.endswith(search_endung): + li_all.append(FullPATH) + elif not search_string is False: + if not FullPATH.find(search_string) == -1: + li_all.append(FullPATH) + else: + li_all.append(FullPATH) + return li_all + + + + + + + + + + +def main(): +# test = show_all_files_directory(dir_path=os.sep + "home" + os.sep + "jonnybravo" + os.sep + "Downloads", search_string="linux") +# for i in test: +# print(i) + print(os.get_exec_path()) +if __name__ == "__main__": + main() \ No newline at end of file