Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Network Folder - Free Space 2

Status
Not open for further replies.

TLowder

Programmer
Joined
Mar 20, 2002
Messages
224
I've read a lot and tried a lot of ways to read the free space of a network folder. Such as API, WMI, FSO none seem to work on a network folder. I found if I map the drive I can easily read the free space; but i would rather not have to. Anyway what I do is backup the data set to another computer basically once or twice a day. After years of data, the computer being backed up to started acting funny, such as missing print jobs, gui controls just plain missing, etc., due to the lack of hard drive space. I would like to read the available space of a folder such as \\somecomputer\backupdata. Even windows (XP pro is what I use) will not give you this info via properties through network neighborhood unless you map the drive. Is there a way I can read the free space so I can alert the user when it is time to clean up old backups, without mapping the drive from every computer?

Thanks,
Tom

Tom
 
Have you actually tried the approach described in How To Use the GetDiskFreeSpaceEx() API to Obtain Disk Free Space Amounts?

This respects user disk quotas as well, giving realistic figures. Share names must include the trailing "\" character:
NOTE: If you enter a directory on the disk of interest in the text box [of the demo application] as a Universal Naming Convention (UNC) name, you must terminate it with a backslash. For example, "\\MyServer\MyShare" must be specified as "\\MyServer\MyShare\". You can specify any directory on the disk. If you do not specify a directory, GetDiskFreeSpaceEx returns information about the disk that contains the current directory.
 
Thanks to both of you.
vb5prgrmr - Not a bad idea at all but it turns out I don't need to map the drive to get the information.

dilettante - Your right and if I had gone to Microsoft first I would have not had problems. I was using an example by HughLerwill found here I failed to notice this example was setup to truncated anything beyond the length of 2 so it only checks the drive letter and : in case of trailing info with - Drive$ = Left$(Drive$, 2) & "\".

I guess I was too quick to think it just wouldn't work due to Windows not giving this info when going to properties through network neighborhood; So I didn't take a close enough look at the example I was using.

Thanks

Tom
 
T - Sorry, I never considered using it on a share.

dil - Thanks
 
HughLerwill,
No need to be sorry :-). I didn't mean to imply, if I did, there was anything wrong with your example. I just didn’t look close enough to its purpose. I'm guessing the way the user selected the drive in your program perhaps caused extra conflicting characters you needed to remove - such as "C:\ local disk" or something.

Thanks,

Tom
 
That's always a risk.

I'm just as guilty of posting a code sample knowing full well that it makes assumptions and then failing to remember to state those assumptions. All we can do is try to be more explicit next time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top