How to generate a list of all the ‘.exe’ files available in ‘C:\Windows\system32’ directory and store them in a log file created in the C drive with the name of ‘entries_Win10.log’.
What have you tried?
This is a place for helping people to learn Python, not for people to solve your problems for you. If you're not going to write code, we have nothing to help with.
You should try yourself as this is a relative easy task,we do not like a task posted without any effort,then is more job description.
That's said here a start(saving to log file you should try yourself), these days
pathlib is a more modern way to do it.
import pathlib
win_dir = r'C:\Windows\System32'
for file in pathlib.Path(win_dir).glob('*.exe'):
if file.is_file():
print(file)
sasitha96,
The code provided works, of course you can simply capture to a file or code the file capture in Python. Or you could use DOS
C:\Windows\System32>dir *.exe >> E:\\mafiles.txt
Or run the Python code and output to a file:
C:\python3.8.5>python check.py >> EXEFILES.TXT
Best,
Dave
(Sep-19-2021, 06:47 PM)nilamo Wrote: [ -> ]What have you tried?
This is a place for helping people to learn Python, not for people to solve your problems for you. If you're not going to write code, we have nothing to help with.
sorry for that

(Sep-19-2021, 06:48 PM)snippsat Wrote: [ -> ]You should try yourself as this is a relative easy task,we do not like a task posted without any effort,then is more job description.
That's said here a start(saving to log file you should try yourself), these days pathlib is a more modern way to do it.
import pathlib
win_dir = r'C:\Windows\System32'
for file in pathlib.Path(win_dir).glob('*.exe'):
if file.is_file():
print(file)
thanks
