Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see Why Migrate to InterSystems IRIS?


Work with files programmatically (read, write, copy, rename, and so on).


ObjectScript, MVBasic, and Caché Basic provide commands for working with files and other devices.

Available Tools

In addition, InterSystems provides the following tools:

%File class

Represents disk files and provides utility methods for working with files, directories, and drives. This class includes instance methods like the following:

  • Clear()

  • Open()

  • Rewind()

  • And others

And it also contains class methods like the following:

  • ComplexDelete()

  • CopyFile()

  • ManagerDirectory()

  • NormalizeFilenameWithSpaces()

  • Rename()

  • SetReadOnly()

  • TempFilename()

  • And others

Note that this class is a fairly simple wrapper around the Caché file commands. For simply reading or writing to a file, it is suggested that you use the file stream classes. These open the file using the correct mode automatically in order to read or write to the file and thus are simpler to use.

Availability: All namespaces.

Ensemble file adapters

Enable an Ensemble production to read and write files. See Using File Adapters with Ensemble.

These adapters are included automatically in many Ensemble specialized business host classes.

Availability: All Ensemble-enabled namespaces.

See Also