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, use *.fil to list files with the .fil extension (ACL data files). Similarly, Inv*.* lists only files that begin with “Inv” regardless of what file extension they have. Results\* or Results\*.* lists all files in the Results folder.

To specify a particular folder, you can specify a path relative to your ACL project folder, such as Results\*.* to display the contents of the Results subfolder, or a full path, such as C:\ACL Data\Results\*.*. Paths or file names that contain spaces must be enclosed in double quotation marks.

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 filenames 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 should be appended to the end of an existing file instead of overwriting the existing file. You must ensure that the structure of the two files is identical when using this parameter, if maintaining a consistent file structure is important (e.g., 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 file to output the results to, and optionally a file path. For example, specify C:\ACL Data\Results\files.fil or Results\files.txt, or omit the path to save the file in the folder containing the ACL project. 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 results 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) 2013 ACL Services Ltd. All Rights Reserved. | Send feedback