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
Shared Environment Routines / Copying and Moving Files


PBHMoveRename

You can use the PBHMoveRename function to move a file or directory and optionally to rename it.

FUNCTION PBHMoveRename (paramBlock: HParmBlkPtr; 
                        async: Boolean): OSErr;
paramBlock
A pointer to a copyParam variant of the 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.
-->ioNewNamePtrA pointer to the destination pathname (may be NIL).
-->ioCopyNamePtrA pointer to the file's new name (may be NIL).
-->ioNewDirIDLongIntThe destination directory ID.
-->ioDirIDLongIntThe source directory ID.

DESCRIPTION
The PBHMoveRename function allows you to move (not copy) a file or directory and optionally to rename it. The source and destination pathnames must point to the same file server volume.

You specify the source file or directory with the ioVRefNum, ioDirID, and ioNamePtr fields. You specify the destination directory with the ioNewDirID and ioNewName fields. If ioNewName is NIL, the destination directory is the directory having ID ioNewDirID on the specified volume; if ioNewName is not NIL, the destination directory is the directory having the partial pathname pointed to by ioNewName in
the directory having ID ioNewDirID on the specified volume.

The ioCopyName field may contain a pointer to an optional string to be used in copying the file or directory; if it is not NIL, the moved object is renamed to the name specified
in ioCopyName. The string pointed to by ioCopyName must be a filename, not a
partial pathname.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for PBHMoveRename are
Trap macroSelector
_HFSDispatch$0037

RESULT CODES
noErr0No error
fnfErr-43Source file or directory not found
fLckdErr -45File is locked
vLckdErr -46Destination volume is read-only
dupFNErr -48Destination already exists
paramErr-50Function not supported by volume
badMovErr-122Attempted to move directory into offspring
afpAccessDenied-5000The user does not have the right to move the file
or directory

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996