[comp.sys.mac.programmer] Implementation of Get Info for Catalog

iron@imag.imag.fr (Francois Menneteau) (02/24/89)

	I want do realize the "Get Info feature" by program e.g I want a
procedure, say GetCatFilesInfo, that gives me the entire size of a specific
catalog, and the number of files and catalogs within this catalog.

	Thus, reading IM..., I must use GetCatInfo(). The body of the procedure
(in C) is :

		OsErr GetCatFilesInfo(TheCInfoPBPtr)
		CInfoPBPtr	TheCInfoPBPtr ;
		{
			do a GetCatInfo(TheCInfoPBPtr) ;
			do a PBOpenWD(&LocalWDPBRec) ;

			for ( i = 1 ; i < TheCInfoPBPtr->dirInfo.ioDrNmFls ; i++ )
			{	working on a local CinfoPBRec, retrieve info for each file
				(using ioFDirIndex and ioDrDirID fields).

				GetCatInfo(&LocalCInfoPBRec) ;

				if ( file is a directory )
				{	call GetCatFilesInfo() ;

					/* THE PROBLEM IS HERE!!!!!! 
					   WHICH FIELDS MUST I USE, IN ORDER TO RETRIEVE
					   RECURSIVELY THE OTHER FILES AND CATALOGS ?
					*/

				}

				retrieve ioFlLgLen and ioFlRlgLen and other stuffs, from
				LocalCInfoPBRec.
			}

			do a PBCloseWD(&LocalWDPBRec) ;
		}


Any information or C source code will be very appreciate.


-- 
\\\\\\\\\\\\\\\\\\\\\\\\\\  "... I had their lives in my hands
 \ iron@imag.imag.fr      \  their fate their fortune in my visions
 / uunet.uu.net!imag!iron /  No one believed in my true prophecy
//////////////////////////   And now it's too late."

bob@accuvax.nwu.edu (Bob Hablutzel) (02/25/89)

The definitive answer is in Tech Note #68, which gives the complete code
for walking down a tree. The important field is ioDrDirID, which gives the
DirID for the folder found. By specifying this DirID as the folder to search
in the next call, you can walk down the tree.

Bob Hablutzel	Wildwood Software	BOB@NUACC.ACNS.NWU.EDU