Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bytes in a directory
Message
De
30/03/1998 18:48:54
 
 
À
30/03/1998 09:59:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00088089
Message ID:
00088264
Vues:
30
>>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
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform