# When dealing with a directory of files it is often necessary to work on
# the list.
use Files::List;
# list() will return a list of files that fit a regular expression mask. Only the
# file name is compared against the mask. The fill name and path is
# returned. This path may be relative or absolute, depending on the input
# path. The result can be used as the input to a compare method to find
# the most recently changed file in the list.
$mask = '\.txt$';
@files = Files::list( $mask, 'path1',...);# 1 level
$files = Files::list( $mask, 'path1',...); @$files;
# listTree goes one further by returning files matching the mask on
# the path and any directories under the path. Again the mask is only
# measured against the file name.
@files = Files::listTree( $mask, 'path1', 'path2', ...);
$files = Files::listTree( $mask, 'path1', 'path2', ...); @$files;
# returns ('path1/one.txt', 'path1/subdir/two.txt', 'path2/three.txt', ...)
# while listTree only returns files, listDirectories only returns directories -
# under a single specific directory. It does not walk lower than the one level.
@dirs = Files::listDirectories( 'path1');
$dirs = Files::listDirectories( 'path1'); @$dirs;
# returns ('path1/subdir1', 'path1/subdir2'...) - one level only