WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

DiskFree and DiskSize returning incorrect values
Disksize doesn't work with logical drives ?

Keywords: diskfree disksize 

Question (DiskSize on Networked Drive):

I'm using networked NT4, and I would like winbatch to kick-in when a user logs in, and detect if the user has more than 5Meg in their home (H:) directory. However, when I use disksize ("H:") it returns the total amount of usage on the entire physical disk (ie 4Gig) rather than on the logical H:

Is there a trick I'm missing ? Filesize(*.*) returns the correct answer.. but it's not useful since it doesn't recurse through subdirectories.

Answer:

  1. The DiskSize function returns real information, not the size of the mapped disk's files, so Diskfree may not be able to accurately report the free disk space on a network drive.

  2. You may wish to try out SEARCHER extender. It can recurse subdirectories and I believe there is an example in its help file that shows you how to get total filesize for some volume or directory tree.

  3. DiskFree and DiskSize may return incorrect values if your hard drive(s) for which you're trying to get values exceed 2 gigabytes.

  4. There also were problems with Diskfree in the older versions of WinBatch. In WinBatch v5.0N, we fixed Diskfree to return a floating point # if the result is larger than 2 Gigs.

See the following documentation from the Microsoft Win32 Software Development Kit documentation:

Windows 95:

The GetDiskFreeSpace function returns incorrect values for volumes which are larger than 2 gigabytes. The function caps the values stored into *lpNumberOfFreeClusters and *lpTotalNumberOfClusters so as to never report volume sizes that are greater than 2 gigabytes.

Even on volumes that are smaller than 2 gigabytes, the values stored into *lpSectorsPerCluster, *lpNumberOfFreeClusters, and *lpTotalNumberOfClusters values may be incorrect. That is because the operating system manipulates the values so that computations with them yield the correct volume size.

Windows 95 OSR 2:

The GetDiskFreeSpaceEx function is available on Windows 95 systems beginning with OEM Service Release 2 (OSR 2). The GetDiskFreeSpaceEx function returns correct values for all volumes, including those that are greater than 2 gigabytes.

Question (DiskSize on Novell 3.12 Server):

Hi, I'm using disksize and diskfree to create monthly reports on diskusage. Recently the 32-bit novell client for w'95 has been installed on my system. Suddenly disksize gives wrong values. My collegue doesn't have the novell client and his system returns correct values. The disks are volumes on novell 3.11 and 3.12 servers and I'm connected in bindery mode.

The wrong values are given by Novell 3.11 servers. 3.12 Servers give correct values.

Answer:

  1. For Windows 95 machines accessing NT servers and other Win95 machines, Win95 Service Pak 1 fixes some volume size problems.

  2. It looks like the Novell 3.12 fix updates volume size problems found in Novell 3.11. I think Novell 3.11 came out before the larger hard drives and that is causing the problems.

Article ID:   W13054
Filename:   DiskSize and DiskFree returning incorrect values.txt
File Created: 1999:04:15:16:51:26
Last Updated: 1999:04:15:16:51:26