>>>Are there VFP functions that return the total bytes in a directory and bytes of individuals files? Thanks in advance.
>>>
>>>Andy Ahrndt
>>>aahrndt@mindspring.com
>>
>>FSIZE() will return file size (if SET COMPATIBLE ON). You can collect all file names into array using ADIR() and calculate total size looping through this array.
>
>Actually, while it will show use the number of bytes used, it won't show you the amount of disk space in use, since files are allocated in fixed-size blocks, resulting in wasted space (slack space) at the end of each file. You need to determine the blocksize of the partition being used, and then examine the size of each file, and compute the number of blocks used per file. The total number of blocks in use is the total space taken up on the drive, including the slack space in each file allocation. Add to this the size of the directory in blocks (trivial to compute in the old DOS world, but non-trivial with LFNs, and especially with file systems like NTFS and NetWare), multiply the result by the blocksize, and you have the current space allocated to the directory..
>
>Computing the space needed when moving files is similar, except that the blocksize of the target drive needs to be used in the calculation (you still use the number of bytes in use in actual use for each file; the slack space changes as the blocksize changes.)
>
>Ed
Actually, Ed, getting the cluster size of a drive isn't too hard with VFP (or for that matter the versions that preceded it). All you need to is call SYS(2022).
George
Ubi caritas et amor, deus ibi est