Getting the paths for “Special Folders”

I’ve been cutting some code today (for once!) and I needed to find out the location
of the users “My Documents” folder. 

A bit of a dig and I stumbed across System.Envrionment.SpecialFolder.Personal, I’d
never come across this before (probably because I wasn’t looking for it), but
it’s great to see that you can get all of the “standard” directories which can of
course change on different peoples machines.

e.g. My “MyDocuments” is actually routed to a directory on a remote server which is
backed up so relying on C:\Documents And Settings\USER isn’t reliable enough

The actual code to get a users “My Documents” is:

System.Environment.GetFolderPath( System.Environment.SpecialFolder.Personal )

More here:

Comments (0)