Directory recursion

  • Thread starter Thread starter Rex the Strange
  • Start date Start date
R

Rex the Strange

Hi everyone,

Surely this isn't that hard:

I'm trying to create a routine which is recursive across the entire
directory structure on a designated drive (from the root directory
through every folder on the drive - system, hidden, the lot).

And I'm getting, when I try:

directoryinfo.getdirectories

on a system folder, the dreaded "unauthorized access exception." I
have set the UAC settings to "requireAdministrator" as one post
suggested. I am running as an administrator (I'm the only user of this
computer). Some posts suggest "impersonation" - but I haven't found an
easy explanation of what this is all about.

Who do I have to kill to get past this? Please help?

tia,
rts
 
Surely this isn't that hard:
I'm trying to create a routine which is recursive across the entire
directory structure on a designated drive (from the root directory
through every folder on the drive - system, hidden, the lot).

And I'm getting, when I try:

directoryinfo.getdirectories

on a system folder, the dreaded "unauthorized access exception." I
have set the UAC settings to "requireAdministrator" as one post
suggested. I am running as an administrator (I'm the only user of this
computer). Some posts suggest "impersonation" - but I haven't found an
easy explanation of what this is all about.

Who do I have to kill to get past this? Please help?

You shouldn't need to go down impersonation or UAC routes if you're running
as administrator.

What "system" folder are you talking about here?

Also Could you post the code/function?
 
Rex said:
Hi everyone,

Surely this isn't that hard:

I'm trying to create a routine which is recursive across the entire
directory structure on a designated drive (from the root directory
through every folder on the drive - system, hidden, the lot).

And I'm getting, when I try:

directoryinfo.getdirectories

on a system folder, the dreaded "unauthorized access exception." I
have set the UAC settings to "requireAdministrator" as one post
suggested. I am running as an administrator (I'm the only user of this
computer). Some posts suggest "impersonation" - but I haven't found an
easy explanation of what this is all about.

Who do I have to kill to get past this? Please help?

If you don't have the rights to view the directory, you don't have the
rights. This really has nothing to do with .NET, but the bottom line
is: if you want to be able to view every single directory on the disk,
you have to be executing the code with the privileges of a user that has
security access to every single directory on the disk.

Simply running with admin rights may well not be enough, depending on
how the permissions on the disk are configured.

Pete
 
Rex said:
Hi everyone,

Surely this isn't that hard:

I'm trying to create a routine which is recursive across the entire
directory structure on a designated drive (from the root directory
through every folder on the drive - system, hidden, the lot).

And I'm getting, when I try:

directoryinfo.getdirectories

on a system folder, the dreaded "unauthorized access exception." I
have set the UAC settings to "requireAdministrator" as one post
suggested. I am running as an administrator (I'm the only user of this
computer). Some posts suggest "impersonation" - but I haven't found an
easy explanation of what this is all about.

Who do I have to kill to get past this? Please help?

tia,
rts

Your code is probably trying to do something like looking inside the
trashcan folder.

Check the attributes of each folder. If it's a hidden system folder,
just skip it.
 
Your code is probably trying to do something like looking inside the
trashcan folder.

Actually, my money's on System Volume Information. Locked down tight as a
drum.
 
Back
Top