English

How To: Search for files in a remote directory using the wildcard

Procedure

Description:

The AML [LISTFILE] and [FILELIST] functions can be used to search for files with a given search string. Using these functions to search for all files in a directory, other than the current workspace, via a * wildcard delimiter returns an AML error and the functions don't work. How can these functions work to search via a wildcard?

Cause:

The combination of wildcard delimiter (*) following a slash (/) as part of the search criteria is interpreted by AML as a comment indicator. As a result, the rest of the line is ignored.

Solution:

To be able to search a directory using the wildcard delimiter you need to enclose the path within single quotes.

1) This example specifies the path directly:

&SETVAR a = [LISTFILE '/pop3/tech/jt/junk/*.aml' -FILE]

2) This example uses a variable to specify the path:

&SETVAR a = '/pop3/tech/jt/junk/*.aml'
&SETVAR b = [FILELIST %a% out_file_name -FILE]