Link to home
Start Free TrialLog in
Avatar of GPrentice00
GPrentice00

asked on

how to skip over "system volume information"

On my Win2000, VB6 machine:

Using the Filesystemobject in VB to recursively examine some folders, one of the folders that appears is the "system volume information".  Its properties are Read only, hidden, system, directory, archive.  A folder object can be set to this, but for recursive purposes, I access the folderobject.subfolders collection.  But the program crashes at this point, runtime error 70: permission denied.  Same type of error when trying to click on this folder in explorer...  I can see it in the explorer folded view, but cant get into it.

I don't really care about that folder anyways, so I want to skip over it at that point and continue with the other folders in the list, but I want a method specific to that special type of special folder.

I want to include other hidden, system folders in my examination, so using the file attributes to exclude it are out of the question.  I've gone batty looking at each fso and folder property to see if theres something unique for that folder, but don't see anything.

Will this folder ALWAYS be called "System volume information" and allow a folder name exclusion?  Will this folder always be in the C:\ path, or will one exist for each NTFS drive?  Is this something that originated in NT and carries through to XP, or is it unique to Win2000?  Is there an equivalent XP complicated folder?
Does win98 or win95 have any bizarre folders like this - I think not, as I'm sure I one used a similar recursive approach on a Win98 system, but now I'm beginning to doubt myself...
Avatar of DeAn
DeAn

quick way, add this to top of sub that error happens.

On Error Resume Next
Avatar of GPrentice00

ASKER

On Error Resume Next

Yes, it does work, but much like using   As Any  in my API declarations, I would rather juggle flaming chainsaws.

not sure if this will help..

'Attribute 8 is: Disk drive volume label, read-only.

Dim fs, f
Dim FilePath As String
FilePath = "C:\Path\To\file.ext"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(fs.GetFileName(FilePath))
If f.Attributes <> 8 Then
    'do your thing...
End If
the FSO system will allow you to set a folder object to the "system volume information" path, but as soon as you try to set a folder to the subfolder collection for it, or if you try to set access the filepath for "system volume information" files, it hits the error.  

Your code is the correct way to examine a single file of specified path, (actually it still likely to crash as it is: you should first check if it exists), but took the fork in the road long ago diverging it from the problem at hand..

But thanks for trying still!


DeAn

I'm a bit torn.  Technically, your On Error  solution is a correct answer (one that I should have specified in my Q that I was not wanting to use, but I didnt), although not an answer I find satisfactory.

If you insist, I'll give you 20pts in a new question, and clear this.

The question as it stands is still open for answers - few questions are ever finalized, there's always a better way.
But for practical purposes, this issue is moot at this time now.

Will post request for closure
A request for a refund has been made.  Experts you have 72 hours to object to the refund.

SpideyMod
Community Support Moderator @Experts Exchange
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial