GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Python_Scripting_documents/5.Document-find-all-files.py at master · surendra1453/Python_Scripting_documents Expand file tree/ Copy path5.Document-find-all-files.pyMore file actions 22 lines (21 loc) · 883 Bytes / Copy path5.Document-find-all-files.pyFile metadata and controls22 lines (21 loc) · 883 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #!/usr/local/bin/python3 import os req_path=input("Enter your directory path: ") #req_ex=input("Enter the required files extention .py/.sh/.log/.txt: ") if os.path.isfile(req_path): print(f"The given path {req_path} is a file. Please pass only directory path") else: all_f_ds=os.listdir(req_path) if len(all_f_ds)==0: print(f"The given path is {req_path} an empty path") else: req_ex=input("Enter the required files extention .py/.sh/.log/.txt: ") req_files=[] for each_f in all_f_ds: if each_f.endswith(req_ex): req_files.append(each_f) if len(req_files)==0: print(f"There are no {req_ex} files in the logcation of {req_path}") else: print(f"There are {len(req_files)} files in the location of {req_path} with an extention of {req_ex}") print(f"So, the files are: {req_files}") |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |