Mittwoch, 29. Dezember 2010

Delete specific folders

This script is designed to search and delete temporary folders, which are created by MS Patch / Hotfix Installations. The script can be easily adopted to be used for other folders also. This script will find and delete hidden and system folders also, so be careful when using it.
The script uses the Windows Scripting Host functions.

DIM fso, folder, subflds, fld
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("c:\winxp")
Set subflds = folder.SubFolders
For Each fld in subflds
  if strcomp(left(fld.name,1),"$",1)=0 then
    fso.DeleteFolder("c:\winxp\" & fld.name)
  end if
Next

Keine Kommentare:

Kommentar veröffentlichen