next up previous index
Next: Checking Files Up: File System Previous: Current Directory

Looking at Directories

To look at the contents of a directory, read_directory/4 is available.   It takes a directory pathname and a filename pattern and returns a list of subdirectories and a list of files matching the pattern. The following metacharacters are recognised in the pattern: * matches an arbitrary sequence of characters, ? matches any single character, [] matches one of the characters inside the brackets unless the first one is a space in which case it matches any character but those inside the brackets.

[eclipse 1]: read_directory("/usr/john", "*", Dirlist, Filelist).
Dirlist = ["subdir1", "subdir2"]
Filelist = ["one.c", "two.c", "three.pl", "four.pl"]
yes.


Micha Meier
Mon Mar 4 12:11:45 MET 1996