Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Need to know the proper way to calculate the total used size of a *specific* directory on the NAS and the total size allocated for that directory, I have been able to get the total size and used space of the actual main NAS location by using DriveInfo class but not a particular directory with its files and sub folder. any ideas? thank you!
Posted
Comments
Member 8714829 26-Sep-12 13:55pm    
This piece of info may also help, my application actually maps the NAS location to the local server giving it a network mapped drive first, then I attempt to get the NAS location used space and total size....
OriginalGriff 26-Sep-12 14:11pm    
I don't know if that is going to be possible without knowing more about your NAS. For example, mine does not (by default) establish folder size limits - all shared folders report the same amount of space. I.e., if there is 2TB of total space on the NAS, and the disk(s) are 50% full, with two shares, both shares report 1TB used, and 1TB free, rather than 750GB and 250GB with 1TB free.
Member 8714829 26-Sep-12 14:16pm    
ok, how r u doing it? see I can map the nas onto the server I am running my applciation on, but when I calculate the NAS location, the application returns to me the statistics of the root nas location and not down to the last sub folder mentioned in the NAS path (when mapped), so if u show me how u r doing it I can at least attempt your way and find out on my side the answer to your question.
Member 8714829 26-Sep-12 15:01pm    
for example, I am assigning the following result to a variable but the result represent the free space percentage of the entire NAS and not the specified nas location:

DriveInfo driveInfo = new DriveInfo(driveName); //driveName is the network mapped drive to the local system where I am running my test on.
(long)driveInfo.TotalFreeSpace / driveInfo.TotalSize;

How can make the needed change to get me the size of the full nas path with its sub folders/files...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900