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 1 - Introduction to File Management / File Management Reference
File and Directory Manipulation Routines / Opening, Creating, and Deleting Files


FSpDelete

You can use the FSpDelete function to delete files and directories.

FUNCTION FSpDelete (spec: FSSpec): OSErr;
spec
An FSSpec record specifying the file or directory to delete.
DESCRIPTION
The FSpDelete function removes a file or directory. If the specified target is a file, both forks of the file are deleted. The file ID reference, if any, is removed.

A file must be closed before you can delete it. Similarly, a directory must be empty before you can delete it. If you attempt to delete an open file or a nonempty directory, FSpDelete returns the result code fBsyErr. FSpDelete also returns the result code fBsyErr if the directory has an open working directory associated with it.

RESULT CODES
noErr0No error
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
fBsyErr-47File busy, directory not empty, or working directory control block open
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