DIRECTORY command

Used to display a list of files and folders in the specified directory.

Syntax

DIRECTORY <file_spec> <SUPPRESS> <SUBDIRECTORY> <APPEND> <TO file_name>

Parameters

file_spec

Optional. Specifies the Windows folder or files to display information for.

You can use the asterisk wildcard (*) to list files with a particular extension, files that start with a particular string, or all files in a folder. For example:

  • *.fil – lists all files with the .fil extension (ACL data files)

  • Inv*.* – lists all files that begin with “Inv” regardless of what file extension they have

  • Results\* or Results\*.* – lists all files in the Results folder

To limit the files listed to a particular folder, you can specify a path relative to the ACL project folder, or specify a full path. For example:

  • Results\*.* – displays the contents of the Results subfolder in the ACL project folder

  • C:\ACL Data\Results\*.* – displays the contents of the specified folder

Paths or file names that contain spaces must be enclosed in double quotation marks.

If you use the file_spec parameter, it must be placed before any of the other parameters. If the file_spec parameter appears in any other position, the DIRECTORY command is not processed and an error is generated.

If you omit the file_spec parameter, all files in the folder containing the ACL project are listed. You cannot use any of the other parameters if you omit the file_spec parameter.

SUPPRESS

Optional. Suppresses path information in the output, leaving only the file names and properties.

SUBDIRECTORY

Optional. The contents of subfolders are included in the directory listing. For example, if the file_spec parameter is Results\*.fil, the Results folder, and all subfolders nested under the Results folder, are searched for .fil files. Depending on the number of subfolders and files that need to be listed, using this parameter may result in a delay while the subfolders are searched. ACL displays a dialog box showing progress of the command.

APPEND

Optional. Specifies that command output is appended to the end of an existing file instead of overwriting it. When using this parameter, you must ensure that the structure of the command output and the existing file is identical, if maintaining a consistent file structure is important (for example, when you are appending data to an existing ACL table), because ACL appends output to an existing file regardless of its structure.

TO file_name

Optional. Specifies the name of an ACL table or a file to output the results to, and optionally a file path. For example:

  • files.fil or files.txt – saves the table or file in the folder containing the ACL project

  • Results\files.txt – saves the table or file in the Results subfolder in the ACL project folder

  • C:\ACL Data\Results\files.fil – saves the table or file in the specified folder

Paths or file names that contain spaces must be enclosed in double quotation marks.

Remarks

The DIRECTORY command is similar to the DIR command in Windows. In addition to listing files and subfolders in a folder, the DIRECTORY command also displays the following file and folder properties:

You can run the command from the command line to display a directory listing on screen, or save the listing to an ACL table or .txt file.

When used in a script, the command provides the ability to examine the file system. For example, you could use the DIRECTORY command 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.

The DIRECTORY command does not include the OPEN parameter. If you are using the command in a script and outputting the results to an ACL table, and you want to open the resulting table, follow the DIRECTORY command with the OPEN command. For example:

DIRECTORY "C:\ACL Data\Results\*" TO Results_Folder_Contents.fil
OPEN Results_Folder_Contents

Examples

a. List all the files in the folder containing the ACL project

DIRECTORY

b. List all the .fil files (ACL data files) in the folder containing the ACL project

DIRECTORY *.fil

c. List all the file names beginning with “Inv” in the folder containing the ACL project

DIRECTORY Inv*.*

d. List all the files in the Results subfolder in the folder containing the ACL project

DIRECTORY "Results\*"

e. List all the files in the specified folder

DIRECTORY "C:\ACL Data\Results\*"

f. List all the .fil files (ACL data files) in the specified folder and any subfolders

DIRECTORY "C:\ACL Data\Results\*.fil" SUBDIRECTORY

g. List all the files in the specified folder and output the results to an ACL table in the folder containing the ACL project

DIRECTORY "C:\ACL Data\Results\*" TO Results_Folder_Contents.fil

The new table “Results_Folder_Contents” is added to the open project.

h. List all the files in the first specified folder and output the results to an ACL table in the second specified folder

DIRECTORY "C:\ACL Data\Results\*" TO "C:\ACL Projects\GL Audit 2014\Results\Results_Folder_Contents.fil"

The new table “Results_Folder_Contents” is added to the open project. The associated data file (Results_Folder_Contents.fil) is created in the specified output folder, which may or may not be the folder containing the ACL project.



(C) 2015 ACL Services Ltd. All Rights Reserved.