### Overview of File System Entities

The File System Framework enables you to use surrogate instances called file system entities to access physical objects that reside on hardware or virtual devices. These surrogate objects are instances of IFileSystemEntity and its subclasses: IFile, IDirectory and IVolume.

- IFileSystemEntity is the base class for all file system entities.
- IFile provides a surrogate object for a file.
- IDirectory provides a surrogate object for a file system directory.
- IVolume provides a surrogate object for a file system volume.

The following figure shows the relationship of surrogate instances to physical objects:

Multiple surrogate objects can refer to the same physical object.

The IFileSystemEntity class defines the common protocol for file system entities. IFile, IDirectory and IVolume derive from IFileSystemEntity and implement protocols specific to each kind of entity.

### Files

An IFile instance is a surrogate entity that maps to a physical file. You locate and create IFile instances using the IFile constructors and IDirectory's lookUp and createFile methods. You can also delete the physical file entity by using a deleteSelf method.

### Directories

An IDirectory instance is a surrogate entity that maps to a physical directory. With it, you can look up an entity within a directory, create a new directory, create a new file, delete the contents of a directory, and delete the directory itself.

### Volumes

IVolume derives from IDirectory because it represents the root directory of a volume. You can treat an IVolume instance much as you would treat an IDirectory instance. IVolume also has several methods you can use to access attributes that are specific to volumes.

### Attributes

Types of attributes for a file system object include:

- Name
- Creation date and time
- Modification date and time

In addition, IFile has a size attribute which you access using the size and setSize functions.

IFileSystemEntity implements functions for accessing the attributes that are common to all file system objects. IDirectory, IVolume, and IFile also implement accessors for attributes that are specific to their corresponding physical file system objects. For example, IFile instances manage end-of-file information stored as an attribute. They also manage storage of the file name, creation date, modification date, file size, and entity type (which in this case is always file).

Introduction to the File System

Instantiating a File System Entity from a Host-Specific Pathname
Instantiating a File System Entity from a Portable Pathname
Creating and Replacing Files and Directories
Creating a File or Directory and Intermediate Subdirectories
Deleting a File or Directory
Accessing the Attributes of Files, Directories and Volumes