System Volume Information

T

TyBreaker

Hi, I'm iterating through the folders on my system and am getting an
exception with "System Volume Information". Obviously it's a region I'm
not supposed to access so I'm trying to filter it out by checking for
the folder name before trying to use it:

If Folder.Name <> "System Volume Information" Then
GetFolderDetails(Folder)
End If

But for some reason the if statement is not matching and I'm getting a
run time exception within my GetFolderDetails because it is trying to
access the files in that folder. Can anyone explain why it doesn't get
caught by my if?
--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
 
S

Stephany Young

First of all, what is the value of Folder.Name when you hit the folder in
question?

I notice that I can access the 'System Volumne Information' folder on my
stystem drive but not on any of my other local hard drives where I get an
'Access Denied'.

Wrap your GetFolderDetails(Folder) call in a try catch and handle the
exception.
 
T

TyBreaker

Stephany said:
First of all, what is the value of Folder.Name when you hit the folder in
question?

Well according to the break point I have in my GetFolderDetails routine,
the argument passed to the routine is the string "System Volume
Information" which is why I'm puzzled that my if statement doesn't catch
it. I shall double check with some debugging output.
Wrap your GetFolderDetails(Folder) call in a try catch and handle the
exception.

If I have to use Try...Catch I will but I dislike that particular
construct as it tends to hide where errors are coming from so was hoping
to use an if statement to make it obvious as to why I did it.

--
______ ___ __
/_ __/_ __/ _ )_______ ___ _/ /_____ ____
/ / / // / _ / __/ -_) _ `/ '_/ -_) __/
/_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
/___/

There are 10 types of people in this world; those who understand the
binary numbering system and those who don't.

There's no place like 127.0.0.1.

ASCII a silly question, get a silly ANSI.
 
?

=?iso-8859-1?Q?Jos=E9_Manuel_Ag=FCero?=

Hello TyBreaker,

There can be a number of folders you can't access on any volume. Even the System Restore folder can have a different name than System Volume Information.
So you should trap any exception while accessing the file system. In your case, you can use something like this:
Try
GetFolderDetails(Folder)
Catch ex As UnauthorizedAccessException

'Do something, like maintain a list of inaccesible folders.

End Try



Regards.





"TyBreaker" <[email protected]> escribió en el mensaje | Hi, I'm iterating through the folders on my system and am getting an
| exception with "System Volume Information". Obviously it's a region I'm
| not supposed to access so I'm trying to filter it out by checking for
| the folder name before trying to use it:
|
| If Folder.Name <> "System Volume Information" Then
| GetFolderDetails(Folder)
| End If
|
| But for some reason the if statement is not matching and I'm getting a
| run time exception within my GetFolderDetails because it is trying to
| access the files in that folder. Can anyone explain why it doesn't get
| caught by my if?
| --
| ______ ___ __
| /_ __/_ __/ _ )_______ ___ _/ /_____ ____
| / / / // / _ / __/ -_) _ `/ '_/ -_) __/
| /_/ \_, /____/_/ \__/\_,_/_/\_\\__/_/
| /___/
|
| There are 10 types of people in this world; those who understand the
| binary numbering system and those who don't.
|
| There's no place like 127.0.0.1.
|
| ASCII a silly question, get a silly ANSI.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

System Icons? 2
Prompting for an IP address 4
Folder size in VB.NET? 3
Form Layout 3
Dynamic buttons 2
VB2005: Controls not appearing on form 3
Floating Menu Bar 6
VB.NET Appbar example? 1

Top