Link to home
Start Free TrialLog in
Avatar of CraigLazar
CraigLazar

asked on

VB.net Get My Documents folder size on Win7

Hi,
I have a small exe that i has a routine in to work out the folder size. I need to work out the folder size of My Documents. Problem is that i think windows 7 security is a problem when my exe runs as it is not picking up the default folder My Documents under c:\Users\Craig\My Documents.

thanks a lot

cheers
Avatar of smilitaru
smilitaru
Flag of Romania image

Hi,

How do you specify the My Documents folder in your code?
You should use: Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Avatar of CraigLazar
CraigLazar

ASKER

Hi,
I have a class which iterates thru all the folders and sub folders on the c drive, in this process i have a simple If statement using INSTR function to look for My Documents
So it finds no match when i pass it C drive, i then have a My Documents on my D Drive which then my process picks it up.
Avatar of Nasir Razzaq
With Win7 (and Vista may be), these folders are difficult to access directly (sometimes even in Explorer). You may have to add special conditions and logic for these folders.
ASKER CERTIFIED SOLUTION
Avatar of smilitaru
smilitaru
Flag of Romania image

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
Thanks so much for the sample code man, it is perfect tweeked it slightly :)