I would like to write script which deletes New Folder.exe regsvr.exe viruses:
My algorithm is following:
1. Get current working directory
2. check if this directory contains file with extension .exe and size = 646656 bytes
3. if there is/are such file/s delete
recursiveley do the steps 1-3 to subfolders of parent folder
I want to ask you about efficiency: Since the root folder may contain thousands folders how it be better implement which imports to use?
Just use
os.walk()to recursively walk the file tree, andos.stat()on the file paths it gives you as it goes.