Vbs : delete all files with the same extension in a folder

The next two lines of code allow you to delete all files with a particular extension in a folder.

Set obj = CreateObject("Scripting.FileSystemObject")
obj.DeleteFile("C:\Windows\*.log")

The example below will delete all of the .log files from the C:\Windows folder.

Romain Drouche

Romain Drouche

System Architect | MCSE: Core Infrastructure

An IT infrastructure expert with over 15 years of hands-on experience. Currently serving as a Systems and Network Project Manager and Information Systems Security (ISS) Lead, I leverage my expertise to ensure the reliability and security of technological environments.

GHinM▶