Returns a string array of file names.


fnames = filesa(fspec)
Parameters:fspec (string) – file specification to search for. Can include path and wildcards.
Returns:fnames (Nx1 string array) – all file names that match or null string if none are found.


Example 1: List all example files

Print out the list of all files located in the GAUSS examples directory which end with the file extension .e.

fspec = getGAUSSHome() $+ "examples/*.e";
print filesa(fspec);

Example 2: Find which start with specific letters

This example will search the current working directory for any file which starts with ch.

fnames = filesa("ch*");

Example 3: Create proc to check if a file exists

proc exist(filename);
   retp(not filesa(filename) $== "");

This procedure will return 1 if the file exists or 0 if not.


fnames will contain file names only; any path information that was passed is dropped.

See also

Functions fileinfo(), shell()