vote up 1 vote down star

FYI: I'm using Windows 7.

In one case, I was just writing a test app to enumerate all files on my system, and I get an "access denied" error for "c:\documents and settings" (which was returned by .net when I said 'give me all subfolders in c:\').

What gives?!

Thanks!

flag
As this is a programming question it belongs on Stack Overflow. You don't need to do anything, it'll get moved if enough (5) people agree. – ChrisF Nov 23 at 21:16
2  
I don't believe this IS a programming question. It might contain programming, but it's about the OS, not the code. – Phoshi Nov 23 at 21:19
@Phoshi - I see where your coming from, well we'll see if anyone else agrees. – ChrisF Nov 23 at 21:31

1 Answer

vote up 0 vote down

c:\documents and settings doesn't -really- exist. It points straight to \users (A halfway decent filepath. I mean, \documents and settings? What were they THINKING?), it's not a real path, and is only there for compatibility reasons. You try to save a file at c:\documents and settings\username\hello.txt, it'll work, but it's only in there for compatibility reasons.

Deleting a file from a USB drive - is it one of those ones that can be set to read only? If so, is it?

link|flag
Yeah, I was trying to say that my app actually got "c:\documents and settings" by calling Directory.GetDirectories(), so I'm confused why the API would return a directory that doesn't actually exist. Anyways, I'm also getting such errors when attempting to scan through other folders. – Christopher Nov 23 at 21:06
It's not the only false folder in the filesystem, unfortunately. It exists, but only barely. I'm afraid it's just something you have to deal with. If the API didn't return it, older programs, or programs that rely on it returning it, would fail, wheras programs being written now can be written BETTER because of it ;) – Phoshi Nov 23 at 21:15
have you tried to take OWNERSHIP of the ENTIRE C drive?? if you do this and set it to the user that you are running the program it should not get accesed denied. – mike Nov 24 at 6:10
NO. That might have been acceptable back on XP, but Vista/7 are trying to change the whole we'll always have admin rights! ethos. You won't, and if you can't write your program without needing them you'd better have a damn good reason. – Phoshi Nov 24 at 8:47

Your Answer

Get an OpenID
or
never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.