开发者

New Folder.exe regsvr.exe deleter in python

开发者 https://www.devze.com 2023-04-04 19:08 出处:网络
I would like to write script which deletes New Folder.exe regsvr.exe viruses: My algorithm is following:

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 fil开发者_运维知识库e 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, and os.stat() on the file paths it gives you as it goes.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号