开发者

New Folder.exe regsvr.exe deleter in python

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜