@FileDir (Formula Language)

Returns the directory portion of a path name, that is, the path name minus the file name.

Note: This @function is new with Release 6.

Syntax

@FileDir( pathname )

Parameters

pathname

Text or text list. Path name of a file.

Return value

directory

Text or text list. The directory part of the path name.

Usage

If the parameter is a list, the function operates on each element of the list, and the return value is a list with the same number of elements.

The directory part of a file name is everything to the left of the file name as demonstrated in the following:

Path name

Directory portion

europe.dat

Null

c:\\europe.dat

c:\

c:\\market\\data\\europe.dat

c:\market\data\

\\europe.dat

\

Use @Right with the path name and @FileDir to extract the file name.

Examples

  1. This computed field formula returns the directory part of the file named by Pathname. If Pathname is list, this formula returns a list of the directory parts of the named files.
    @FileDir(Pathname)
  2. This computed field formula returns the file name part of the file named by Pathname.
    @Right(Pathname; @FileDir(Pathname))
  3. This agent formula displays the directory part of the current database name.
    @Prompt([OK];
    "File directory";
    @FileDir(@Subset(@DbName; -1)))
  4. This agent formula displays the file name part of the current database name.
    pathname := @Subset(@DbName; -1);
    @Prompt([OK];
    "File name";
    @Right(pathname; @FileDir(pathname)))