Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bytes in a directory
Message
From
31/03/1998 09:04:39
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00088089
Message ID:
00088375
Views:
34
>>>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

If the problem is to figure out available disk space then DISKSPACE() should be used.
Edward Pikman
Independent Consultant
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform