Brian Stevens wrote: > I have a back-burner project I'd like to finish & just one thing has me stuck. > > I want to delete a file but I don't want the user to pick it with > FILES. The program just finds it based on its name (I'll probably > check creator and type too but that is another issue). There is no > way to know which folder contains the file, so > SYSTEM(_aplvol/_sysvol) don't help. The following code almost works. > SearchFolder plus the check in FindSomething does find the file, but > since GETCATINFO does not provide a validvRefNum(and isn't supposed > to according to IM), I need to find a way to obtain a valid vRefNum > for the file so I can issue FOLDER(thepath,0) and KILL filename$. > Calling OPENWD returns a minus 1 (-1). I'm probably not providing the > correcting priming parms. > > Any clues would be appreciated. > > TIA, > > Brian Stevens > Hello Brian, I think you should provide the dirID to GetWDRefNum, I would try this: DIM iopb.52 DIM OSErr LOCAL FN GetWDRefNum(volumeID%,dirID&,OSErrAddr&) iopb.ioCompletion& = 0 iopb.ioNamePtr& = 0 iopb.ioVRefNum% = volumeID% iopb.ioWDDirID& = dirID& iopb.ioWDProcID& = _myProcID OSErr = FN OPENWD(@iopb) POKE WORD OSErrAddr&, OSErr END FN = iopb.ioVRefNum% LOCAL FN FindSomething (pbPtr&, searchStrPtr&) DIM found% DIM @ test%, OSErr% found% = _false LONG IF UCASE$(PSTR$(pbPtr&.ioNamePtr&)) = UCASE$(PSTR$(searchStrPtr&)) LONG IF pbPtr&.ioFlUsrWds.fdType& = _"TYPE" AND pbPtr&.ioFlUsrWds.fdCreator& = _"CREA" found% = _true test% = FN GetWDRefNum(pbPtr&.ioVRefNum%,pbPtr&.ioDirID&,@OSErr%) END IF END IF INSTR(0,UCASE$(PSTR$(pbPtr&.ioNamePtr&)),UCASE$(PSTR$(searchStrPtr&))) END FN = found% NSIH Cheers Alain