JustScriptIt
Technical User
I modified the script from
When I execute one of the subfolder causes
When I execute in debug mode, the program reaches
Few times beore it throws the runtime error.
How to troubleshoot?
Code:
Option Explicit
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Dim strDir, objDir
strDir = "d:\"
Set objDir = FSO.GetFolder(strDir)
PrintFiles(objDir)
Sub PrintFiles(pCurrentDir)
Dim aItem, sBaseName
For Each aItem In pCurrentDir.Files
If fso.GetExtensionName(aItem.Path) = "vbs" Then
sBaseName = fso.GetParentFolderName(aItem.path) & _
fso.GetBaseName(aItem.path)
Wscript.echo sBaseName
Wscript.echo
End If
Next
For Each aItem In pCurrentDir.SubFolders
PrintFiles(aItem)
Next
End Sub
When I execute one of the subfolder causes
Code:
(14, 4) Microsoft VBScript runtime error: Permission denied
When I execute in debug mode, the program reaches
Code:
For Each aItem In pCurrentDir.SubFolders
PrintFiles(aItem)
Few times beore it throws the runtime error.
How to troubleshoot?