Re: How to Search C:\ to find a file

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Michael Harris \(MVP\) ("Michael)
Date: 03/11/05


Date: Thu, 10 Mar 2005 17:47:01 -0800


>> set fso = createobject("scripting.filesystemobject")
>> set fo = fso.getfolder("C:\System Volume Information")
>> msgbox fo.files.count '==> Permission denied...
>
> Excuse my ignorance but how would I code it to not look in the System
> Volume Information folder?
>
> Thanks

Assuming some sort of recursive procedure that gets an FSO folder object
passed as an argument...
.
..
...
Call walkFolder(someRootFolder)
...
..
.
sub walkTree(objFolder)

    if objFolder.Name = "System Volume Information" then
        exit sub
    end if

    for each file in objFolder.Files
        'blahblah
    next

    for each folder in objFolder.SubFolders
        Call walkTree(folder)
    next

end sub

-- 
Michael Harris
Microsoft MVP Scripting
http://maps.google.com/maps?q=Sammamish%20WA%20US