Skip navigation.

极湖

无不用其“极”

批量删除 Thumbs.db 文件的 VBScript脚本

,

代码如下:
Dim Shell, FSO, objRootFolder
Set Shell = WScript.CreateObject("Shell.Application")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objRootFolder = FSO.getFolder(Shell.BrowseForFolder(0, "请选择文件夹。注意:所选文件夹以下的 Thumbs.db 文件将被全部删除!", &h11))

If deleteFilesByName(objRootFolder, "Thumbs.db") Then
    MsgBox RootDir + "以下的所有 Thumbs.db 文件已被删除!"
Else
    MsgBox "发生错误!"
End If

'根据文件名删除文件的递归函数
Function deleteFilesByName(objRootFolder, strName)
    If (objRootFolder is Nothing) Then
        deleteFilesByName = False
        Exit Function
    End If
    
    Dim objFolder, objFile
    For Each objFile in objRootFolder.files
        If objFile.Name = strName Then
            objFile.Delete True
        End if
    Next

    For Each objFolder In objRootFolder.SubFolders
        deleteFilesByName objFolder, strName
    Next
    
    deleteFilesByName = true
End Function

发布一个 jQuery 插件 —— ColorPickerCakePHP 和 Zend Framework 逐项比较

Write a comment

You must be logged in to write a comment. If you're not a registered member, please sign up.

July 2009
S M T W T F S
June 2009August 2009
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31