I have a script that is recursively looking through an entire drive. It works great up until the point when I come across a directory that I do not have permission to get into. (for example C:\System Volume Information)
I was wondering if anyone knows of a way that I can circumvent this; to skip over and check out the other directories instead.
here's my script that gives me this error:
I:\My Documents\Filemaker Script\tester.vbs(22, 5) Microsoft VBScript runtime error: Permission denied
thanks for any help you can give
-Mark Wetzel
I was wondering if anyone knows of a way that I can circumvent this; to skip over and check out the other directories instead.
here's my script that gives me this error:
I:\My Documents\Filemaker Script\tester.vbs(22, 5) Microsoft VBScript runtime error: Permission denied
Code:
Option Explicit
Dim ObjFSO
Dim ObjStartDrive
Dim ObjFolder
Dim Folder
Dim ObjFile
Set ObjFSO = CreateObject("Scripting.FileSystemObject")
Set ObjStartDrive = ObjFSO.GetFolder("C:\")
For Each ObjFolder In ObjStartDrive.SubFolders
FindFiles(ObjFolder)
Next
'##############################################
Sub FindFiles(Folder)
Set Folder = ObjFSO.GetFolder(Folder)
Wscript.Echo Folder
Wscript.Echo Folder.Type
For Each ObjFile In Folder.Files
If Instr(1, ObjFile.Name, ".fmp", 1) Then
Wscript.Echo ObjFile.Path
Wscript.Echo ObjFile.DateCreated
Else
End If
Next
If Folder.SubFolders.Count > 0 Then
For Each Folder In Folder.SubFolders
FindFiles(Folder.Path)
Next
End If
End Sub
'################################################
thanks for any help you can give
-Mark Wetzel