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
High-Level HFS Routines / Moving Files or Directories


CatMove

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

FUNCTION CatMove (vRefNum: Integer; dirID: LongInt; 
                  oldName: Str255; newDirID: LongInt; 
                  newName: Str255): OSErr;
vRefNum
A volume reference number, a working directory reference number, or 0 for the default volume.
dirID
A directory ID.
oldName
An existing filename or directory name.
newDirID
If newName is empty, the directory ID of the target directory; otherwise, the parent directory ID of the target directory.
newName
The name of the directory to which the file or directory is to be moved.
DESCRIPTION
The CatMove function moves a file or directory from one directory to another within a volume. CatMove is strictly a file catalog operation; it does not actually change the location of the file or directory on the disk.

The newName parameter specifies the name of the directory to which the file or directory is to be moved. If a valid directory name is provided for newName, the destination directory's parent directory is specified in newDirID. However, you can specify an empty name for newName, in which case newDirID should be set to the directory ID of the destination directory.

Note
It is usually simplest to specify the destination directory by passing its directory ID in the newDirID parameter and by setting newName to an empty name. To specify an empty name, set newName to ':'.
The CatMove function cannot move a file or directory to another volume (that is, the vRefNum parameter 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 HRename.

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 to the file

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996