Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 .NET4
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 8:31am
Comments
Member 8714829 at 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 at 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 at 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 at 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
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 BillWoodruff 220
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,817
2 DamithSL 5,461
3 Manas Bhardwaj 4,946
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2014
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