You are here: Commands > Directory

Directory

Use this command to produce a directory of files and folders stored on a Windows based local or network drive or on a drive on an Arbutus Windows Server. The Directory command also reports file properties, such as size, attributes, dates, times and the total file count for each folder’s directory listing.

Note: When using the Directory command on an Arbutus Windows Server, a table on the server must be open for the Directory command to access the drives on the server.

This command can be issued only in command mode.

When used in a procedure, Directory provides the ability to interact with the file system. In an advanced procedure application, for example, you could use Directory in conjunction with other commands to detect the presence or absence of files, check a file’s size or make decisions based on other file properties.

In its simplest form, Directory operates much like the DIR command in DOS and can be issued on the command line to display directory information in the Command Log.

Note: Some file information is unavailable in certain versions of Windows. Where the information is absent, the field in the output file is created but does not contain any information.

Parameters

In addition to the command parameters described below, the Directory command has the following command parameters: Append, and Noformat. For a description of these parameters, see Command Parameters.

Subdirectory

This parameter, which can be abbreviated as “SUB”, causes all sub-folders below the specified folder to be reported as well. Depending on the number of subfolders and files, using this parameter may result in a delay while the subfolders are searched. Analyzer displays the command’s progress.

Suppress

Use this parameter to suppress path information, leaving only the filename(s) and properties.

To

Use this parameter to output the results to a data file. The data file contains the following fields: filename, size, attributes, creation date, creation time, last access date, last access time, modification date and modification time.

Command Mode Syntax

The Directory command, which can be abbreviated as “DIR”, must be entered as a single line either on the command line or in a procedure.

DIRECTORY <file_mask> <SUPPRESS> <SUBDIRECTORY> <TO table-name> <NOFORMAT> <APPEND>¿

file-mask is a file mask that may be used with the asterisk wildcard. For example, use *.fil to produce a directory of files with the “.fil” filename extension. Similarly, a*.* includes only files that begin with the letter “a”. When no file mask is specified, then *.* is assumed.
table-name specifies the name of the table to which the data is written when the TO parameter is used. To specify a particular folder, you can include a directory path, such as "C:\Data\Filelist" or omit the path to save the file in the Analyzer project folder.

To specify a particular folder, you can use a relative path, such as Data\*.* or a full path, such as C:\Data\*.*.

Note: If no path is specified, then the default path is the Analyzer project folder.

Examples

To produce a directory listing of all Analyzer data files, use the following command:

DIR *.fil

The listing appears in the Command Log.

To list all Analyzer data files on the local drive and output the results to a file named “filelist”, use the following command:

DIR C:\*.fil SUB TO filelist

A new data file named “Filelist.fil” is created in the current folder.