Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retrieves information about the amount of space that is available on a disk volume, which is the total amount of space, the total amount of free space, and the total amount of free space available to the user that is associated with the calling thread.
BOOL GetDiskFreeSpaceExA(
[in, optional] LPCSTR lpDirectoryName,
[out, optional] PULARGE_INTEGER lpFreeBytesAvailableToCaller,
[out, optional] PULARGE_INTEGER lpTotalNumberOfBytes,
[out, optional] PULARGE_INTEGER lpTotalNumberOfFreeBytes
);
[in, optional] lpDirectoryName
A directory on the disk.
If this parameter is NULL, the function uses the root of the current disk.
If this parameter is a UNC name, it must include a trailing backslash, for example, "\\MyServer\MyShare\".
This parameter does not have to specify the root directory on a disk. The function accepts any directory on a disk.
The calling application must have FILE_LIST_DIRECTORY access rights for this
directory.
[out, optional] lpFreeBytesAvailableToCaller
A pointer to a variable that receives the total number of free bytes on a disk that are available to the user who is associated with the calling thread.
This parameter can be NULL.
If per-user quotas are being used, this value may be less than the total number of free bytes on a disk.
[out, optional] lpTotalNumberOfBytes
A pointer to a variable that receives the total number of bytes on a disk that are available to the user who is associated with the calling thread.
This parameter can be NULL.
If per-user quotas are being used, this value may be less than the total number of bytes on a disk.
To determine the total number of bytes on a disk or volume, use IOCTL_DISK_GET_LENGTH_INFO.
[out, optional] lpTotalNumberOfFreeBytes
A pointer to a variable that receives the total number of free bytes on a disk.
This parameter can be NULL.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero (0). To get extended error information, call GetLastError.
The values obtained by this function are of the type ULARGE_INTEGER. Do not truncate these values to 32 bits.
The GetDiskFreeSpaceEx function returns zero (0) for lpTotalNumberOfFreeBytes and lpFreeBytesAvailable for all CD requests unless the disk is an unwritten CD in a CD-RW drive.
Symbolic link behavior—If the path points to a symbolic link, the operation is performed on the target.
Note
The fileapi.h header defines GetDiskFreeSpaceEx as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2003 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | fileapi.h (include Windows.h) |
Library | Kernel32.lib |
DLL | Kernel32.dll |
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!