Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / File Manager Reference
Low-Level HFS Routines / Accessing Information About Files and Directories


PBHRename

You can use the PBHRename function to rename a file, directory, or volume.

FUNCTION PBHRename (paramBlock: HParmBlkPtr; async: Boolean): 
                     OSErr;
paramBlock
A pointer to a basic HFS parameter block.
async
A Boolean value that specifies asynchronous (TRUE) or synchronous (FALSE) execution.
-->ioCompletionProcPtrA pointer to a completion routine.
<--ioResultOSErrThe result code of the function.
-->ioNamePtrStringPtrA pointer to a pathname.
-->ioVRefNumIntegerA volume specification.
-->ioMiscPtrA pointer to the new name for the file.
-->ioDirIDLongIntA directory ID.

DESCRIPTION
Given a pointer to the name of a file or directory in ioNamePtr, PBHRename changes it to the name pointed to by ioMisc. Given a pointer to a volume name in ioNamePtr or a volume reference number in ioVRefNum, it changes the name of the volume to the name pointed to by ioMisc.

Note
If a file ID reference exists for the file being renamed, the file ID remains with the file.
IMPORTANT
You cannot use PBHRename to change the directory in which a file
is located.
ASSEMBLY-LANGUAGE INFORMATION
The trap macro for PBHRename is _HRename.

RESULT CODES
noErr0No error
dirFulErr-33File directory full
dskFulErr-34Volume is full
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename
fnfErr-43File not found
wPrErr-44Hardware volume lock
fLckdErr -45File is locked
vLckdErr-46Software volume lock
dupFNErr-48Duplicate filename and version
paramErr-50No default volume
fsRnErr -59Problem during rename
dirNFErr-120Directory not found or incomplete pathname
afpAccessDenied-5000User does not have the correct access

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996