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 / Moving Files or Directories


PBCatMove

You can use the PBCatMove function to move files or directories from one directory to another on the same volume.

FUNCTION PBCatMove (paramBlock: CMovePBPtr; async: Boolean): 
                     OSErr;
paramBlock
A pointer to a catalog move 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 the name of the file or directory to be moved.
-->ioVRefNumIntegerA volume specification.
-->ioNewNameStringPtrA pointer to the name of the directory into which the file or directory is to
be moved.
-->ioNewDirIDLongIntThe directory ID of the directory into which the file or directory is to be moved, if ioNewName is NIL. If ioNewName is not NIL, this is the parent directory ID of the directory into which the file or directory is to be moved.
-->ioDirIDLongIntThe directory ID of the file or directory to be moved.

DESCRIPTION
The PBCatMove function moves a file or directory from one directory to another within a volume. PBCatMove is strictly a file catalog operation; it does not actually change the location of the file or directory on the disk.

The source file or directory should be specified by its volume, parent directory ID, and partial pathname. Pass a volume specification in ioVRefNum. Pass the parent directory ID in the ioDirID field and a pointer to the partial pathname in the ioNamePtr field.

The name of the directory into which the file or directory is to be moved is specified by the ioNewName field. If a valid directory name is provided for ioNewName, the destination directory's parent directory is specified in ioNewDirID. However, you can specify NIL for ioNewName, in which case ioNewDirID should be set to the directory ID of the destination directory itself.

Note
It is usually simplest to specify the destination directory by passing
its directory ID in the ioNewDirID field and by setting ioNewName
to NIL.
The PBCatMove function cannot move a file or directory to another volume (that is, ioVRefNum is used in specifying both the source and the destination). Also, you cannot use it to rename files or directories; to rename a file or directory, use PBHRename.

If a file ID reference exists for the file, the file ID reference remains with the moved file.

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

RESULT CODES
noErr0No error
nsvErr-35No such volume
ioErr-36I/O error
bdNamErr-37Bad filename or attempt to move into a file
fnfErr-43File not found
wPrErr-44Hardware volume lock
fLckdErr -45Target directory is locked
vLckdErr-46Software volume lock
dupFNErr-48Duplicate filename and version
paramErr-50No default volume
badMovErr-122Attempt to move into offspring
wrgVolTypErr-123Not an HFS volume
afpAccessDenied-5000User does not have the correct access

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996