GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python_Scripting_documents/5.Document-find-all-files.py at master · surendra1453/Python_Scripting_documents

Expand file tree

/

5.Document-find-all-files.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
22 lines (21 loc) · 883 Bytes
/

5.Document-find-all-files.py

Copy path

File metadata and controls

22 lines (21 loc) · 883 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.