modify
This commit is contained in:
21
play_with_os/os_play.py
Normal file → Executable file
21
play_with_os/os_play.py
Normal file → Executable file
@@ -1,5 +1,5 @@
|
||||
#! /usr/bin/env python3
|
||||
import os
|
||||
import os, sys
|
||||
|
||||
def show_all_files_directory(dir_path = str, search_endung = False, search_string = False):
|
||||
li_all = []
|
||||
@@ -26,6 +26,7 @@ def main(check_list = list, main_folder_in = str):
|
||||
run_file_check = show_all_files_directory(dir_path=main_folder)
|
||||
for file_name in run_file_check:
|
||||
output_list.append(str(folder_name + '=' +file_name[1]))
|
||||
output_list.append("")
|
||||
else:
|
||||
print(main_folder, "existiert nicht")
|
||||
return output_list
|
||||
@@ -36,11 +37,19 @@ def main(check_list = list, main_folder_in = str):
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
check_folders = ["Downloads", "Dokumente", "diokdkij"]
|
||||
check_folders = ["Downloads", "Dokumente", "diokdkij", "inv"]
|
||||
|
||||
if len(sys.argv) == 1 or len(sys.argv) == 3:
|
||||
raise SystemExit("Das Skript muss mit einen Parameter aufgerufen werden. Zum Beispiel ./skript.py suma oder python3 skript.py suma")
|
||||
print(sys.argv)
|
||||
output_file = sys.argv[1] + "-module.txt"
|
||||
main_folder = sys.argv[1]
|
||||
#show all Folders from dir
|
||||
test = [os.path.join(".", o) for o in os.listdir(".") if os.path.isdir(os.path.join(".",o))]
|
||||
print(test)
|
||||
running_main = main(check_list=check_folders, main_folder_in=os.sep + "home" + os.sep + "jonnybravo")
|
||||
#test = [os.path.join(".", o) for o in os.listdir(".") if os.path.isdir(os.path.join(".",o))]
|
||||
running_main = main(check_list=check_folders, main_folder_in=main_folder)
|
||||
if os.path.exists(output_file):
|
||||
os.remove(output_file)
|
||||
|
||||
for run in running_main:
|
||||
with open("output_file", "a") as file:
|
||||
with open(output_file, "a") as file:
|
||||
print(run, file=file)
|
||||
Reference in New Issue
Block a user