ded@aplvax.UUCP (12/16/83)
There comes a time when I would like to know how much free space remains on a disk in a CP/M system. The question is: how do I find out? One way is to scan the file directory, keeping a running count of sectors used, and subtract that sum from the total available. Is there an easier way? -- Don Davis JHU/APL ...decvax!harpo!seismo!umcp-cs!aplvax!ded ...rlgvax!cvl!umcp-cs!aplvax!ded
ABN.ISCAMS%usc-isid@sri-unix.UUCP (12/19/83)
Don, Maybe I miss the point to your question. Doesn't STAT give you that answer? And don't several different fancy-format directory programs show the amount of space used by files, and amount remaining? Or is it a different sort of space available/free you're talking about. Regards, David Kirschbaum Toad Hall
brian@sdccsu3.UUCP (12/19/83)
x <- destroy all monsters The easiest way to calculate the available space on a disk is to use the allocation map - the bits turned off in the allocation map are available allocation groups, so you just multiply the number of bits off by the allocation size (available from factors in the disk parameter block) and that is the room left on the disk. You can get pointers to the disk block from the BDOS, then use that to find the allocation vector, maximum number of groups, and the allocation size. See the DRI incomprehensible manuals for the exact details, or take apart the code in one of the public domain directory programs (like SD). Note that using the DPB information makes the program relatively independent of what hardware configuration its running on. -- -Brian Kantor, UC San Diego {decvax,ucbvax} !sdcsvax!sdccsu3!brian Kantor@Nosc
pace@micomvax.UUCP (12/21/83)
You can use the STAT command to find out the free space you have left on a disk. A>STAT this will give you how many k bytes are left on the disk A>STAT *.* this will list every file on the disk, tell you how much space it's using and at the end tell you how much space is left. cheers