Sep-19-2021, 06:15 PM
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’.
| Generate a list |
| Sep-19-2021, 06:15 PM 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’. Sep-19-2021, 06:47 PM 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. Sep-19-2021, 06:48 PM 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) Sep-20-2021, 05:57 PM 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-20-2021, 07:01 PM Sep-20-2021, 07:03 PM (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. thanks |
| |
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| How to generate a log in a list style? | wagnergt12 | 5 | 4,480 | Apr-22-2020, 12:47 PM Last Post: buran | |
| extract first and last 5 elements from given list and generate a new list. | Raj_Kumar | 1 | 3,624 | Dec-07-2019, 05:03 PM Last Post: ichabod801 | |
| I created a function that generate a list but the list is empty in a new .py file | mrhopeedu | 2 | 3,551 | Oct-12-2019, 08:02 PM Last Post: mrhopeedu | |
| Generate list in class | P13N | 7 | 6,886 | Dec-28-2018, 10:08 PM Last Post: P13N | |
| Generate a list of numbers within a list of arbitrary numbers | Takeshio | 4 | 5,312 | Nov-08-2018, 12:29 AM Last Post: Takeshio | |
| How to generate the list I want? | Krookroo | 6 | 6,022 | Sep-07-2017, 02:06 PM Last Post: Krookroo | |