Click here to Skip to main content
13,149,073 members (53,050 online)
Rate this:
Please Sign up or sign in to vote.
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 26-Sep-12 7:31am
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170924.2 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100