[comp.sys.apple] Space on a volume

mdavis@pro-sol.cts.COM (Morgan Davis) (12/27/87)

Bob Church writes:
> [how do you] determine just how much empty space is left on a prodos volume.

Use the MLI's Get_File_Info call on the volume name.  Then look at the
resulting parameter table at these byte offsets:

        +5/+6   Total Blocks on volume

        +8/+9   Blocks used

Just do a subtraction of Blocks used from the Total blocks to get a freespace
block count.

UUCP: [ ihnp4 cbosgd hplabs!hp-sdd sdcsvax nosc ] !crash!pnet01!pro-sol!mdavis
ARPA: crash!pnet01!pro-sol!mdavis@nosc.mil
INET: mdavis@pro-sol.cts.com

dr@ski.UUCP (David Robins) (12/31/87)

In article <> pnet01!pro-sol!mdavis@nosc.MIL writes:
>Bob Church writes:
>> [how do you] determine just how much empty space is left on a prodos volume.
>
>Use the MLI's Get_File_Info call on the volume name.  Then look at the
>resulting parameter table at these byte offsets:
>
>        +5/+6   Total Blocks on volume
>
>        +8/+9   Blocks used
>
>Just do a subtraction of Blocks used from the Total blocks to get a freespace
>block count.
>
There is a way in BASIC also, from the ProDOS /Examples disk.  This is
called READ.DIRECTORY

 10  PRINT D$;"OPEN /EXAMPLES,TDIR"
 20  PRINT D$;"READ /EXAMPLES"
 30  INPUT L1$: PRINT L1$: REM  READ NAME
 40  INPUT L2$: PRINT L2$: REM  READ TITLE
 50  INPUT L3$: PRINT L3$: REM  READ BLANK LINE
 60  INPUT L4$: PRINT L4$: REM  READ FILES
 70  IF L4$ <  > "" THEN  GOTO 60
 80  INPUT L5$: PRINT L5$: REM  READ BLOCK COUNT
 90  PRINT D$;"CLOSE /EXAMPLES"

You can then use string handing to take the part of L5$ that has the
information on total blocks and blocks free.  Note that this reads
various length directories, and gets to the last status line by
waiting for a blank line, (the one between the directory info and the
status line) in line 70.  Obviously, this takes longer since you have
to wait for the whole directory file to be read in.
-- 
					-dave

====================================================================
David Robins, M.D.  (ophthalmologist / electronics engineer)
Smith-Kettlewell Eye Research Foundation
(previously known as: Smith-Kettlewell Institute of Visual Sciences)
2232 Webster St; San Francisco CA 94115
415/561-1705 (voice)
			{ihnp4,qantel,dual}!ptsfa!ski!dr

The opinions expressed herein do not reflect the opinion of the Institute!