TechniqueUse the diskfreespace() function, which returns the number of bytes available in a certain drive or directory: $free_space = diskfreespace("C:\"); CommentsFinding out the amount of free space in a directory seems like a trivial thing, sort of like those background faders that they have for JavaScript, or "under construction" signs on a Web page. To an extent, this is the case, but the diskfreespace() function can be very helpful when debugging or when you need to find out how much free space you have to work with when writing extensible scripts. A little bit about the internals of the diskfreespace() function call: On Windows NT95982000, the diskfreespace() function ”if available ”makes the GetDiskFreeSpaceEx() function call; otherwise , it uses the GetDiskFreeSpace() function call. On other operating systems, it uses the statvfs or statfs function calls. |