Get a Directory File ListAuthor: Carl Sassenrath This example reads a directory and returns all the file and directory names within it.
To see the list, just add a PROBE:
If you want the file list in sorted order:
To read the current directory:
(The dot is a shortcut for the current directory.) You can remove any unwanted filenames from the list with this code:
Here the REMOVE-EACH function removes all file names that do not contain the string "web". The FIND function can include patterns (/any) and matches (/match) as well. If the directory has subdirectories, you can remove them from the list with:
Here's how you combine the above to get file names that contain the string "web" and not directories:
If you want files that have a specific set of suffixes:
Now the list only contains image file names.
|