strDir = "D:\Backup"
strFileExt = "bak"
  
strComputer = "."
  
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  
Set FileList = objWMIService.ExecQuery("ASSOCIATORS OF {Win32_Directory.Name='" & strDir & "'} Where " & "ResultClass = CIM_DataFile")
  
For Each objFile In FileList
        If objFile.Extension = strFileExt Then
' Wscript.echo "Extension : " & objFile.Extension
            objFile.Delete
        End If
Next
2007/12/09 00:11 2007/12/09 00:11

글 걸기 주소 : 이 글에는 트랙백을 보낼 수 없습니다

덧글을 달아 주세요