This article is from the Mac Programming FAQ, by Jon Watte h+@austin.metrowerks.com with numerous contributions by others.
You call (surprise!) PBGetCatInfo followed by PBSetCatInfo for the
FOLDER the file is in. Inbetween, you should set ioDrMdDat to the
current date&time. Code:
*code*
OSErr
TouchFolder ( short vRefNum , long parID ) {
CInfoPBRec rec ;
Str63 name ;
short err ;
rec . hFileInfo . ioNamePtr = name ;
name [ 0 ] = 0 ;
rec . hFileInfo . ioVRefNum = vRefNum ;
rec . hFileInfo . ioDirID = parID ;
rec . hFileInfo . ioFDirIndex = -1 ;
rec . hFileInfo . ioFVersNum = 0 ;
err = PBGetCatInfoSync ( & rec ) ;
if ( err ) {
return err ;
}
GetDateTime ( & rec . dirInfo . ioDrMdDat ) ;
rec . hFileInfo . ioVRefNum = vRefNum ;
rec . hFileInfo . ioDirID = parID ;
rec . hFileInfo . ioFDirIndex = -1 ;
rec . hFileInfo . ioFVersNum = 0 ;
rec . hFileInfo . ioNamePtr [ 0 ] = 0 ;
err = PBSetCatInfoSync ( & rec ) ;
return err ;
}
*end*
 
Continue to: