那麼這裏是我的代碼,但我只是不能使用objFile.Extension篩選上市我相信這是一些無聊的事情VBSCRIPT列表文件夾中的所有PDF文件和子文件夾
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\dev"
Set objFolder = objFSO.GetFolder(objStartFolder)
Wscript.Echo objFolder.Path
Set colFiles = objFolder.Files
For Each objFile in colFiles
If objFile.Extension = "PDF" Then
Wscript.Echo objFile.Name
End If
Next
Wscript.Echo
ShowSubfolders objFSO.GetFolder(objStartFolder)
Sub ShowSubFolders(Folder)
For Each Subfolder in Folder.SubFolders
Wscript.Echo Subfolder.Path
Set objFolder = objFSO.GetFolder(Subfolder.Path)
Set colFiles = objFolder.Files
For Each objFile in colFiles
Wscript.Echo objFile.Name
Next
Wscript.Echo
ShowSubFolders Subfolder
Next
End Sub
上運行它回來與錯誤
(11, 1) Microsoft VBScript runtime error: Object doesn't support this property or method: 'objFile.Extension'
謝謝約翰,做了它 但我有問題試圖過濾子文件夾我沒有太多的運氣 – John 2010-11-18 06:21:56
你能更具體嗎?你是否得到錯誤或其他什麼? – jveazey 2010-11-19 06:51:28