File::DirList - provide a sorted list of directory content
use File::DirList; # my @list = File::DirList::list('.', 'dn', 1, 0);
The module has two methods:
list($dirName, $sortMode, $noLinks, $hideDotFiles, $showSelf)
Produces a list, accepting 5 parameters:
Name of the directory to list
Describes how list should be sorted.
This is a string containing the following symbols, with uppercase representing the reverse sort:
'd' means all the directories will precede files,
'D' means reverse.
Sort by file (or subdirectory) name.
'n' but case insensitive.
Sort by modification time.
Sort by creation time.
Sort by access time.
Sort by size.
$sortMode is interpreted from left to right. If the first comparison produces an equal result next one is used. For example, string
'din' produces a list with all the directories preceding files, directories and files are sorted by name case insensitively, with lowercase letters preceding upper case.
true symbolic links will not be examined. Set it on platforms without symlink support.
true 'dot' files will not be reported.
true '.' directory entry will be reported.
Returned value is an array reference, sorted as described by $sortMode.
Array elements are array references representing an item.
The individual item's array contains 17 elements:
Name of the item.
Is item a directory? Contains 0 for non-directory items, 1 for directories, 2 for
'..', 3 for
'.'. Used by "d or D" sorting.
Is item a link?
0 for non-links,
1 for valid links,
-1 for invalid links.
undef for non-links, target path for links.
Used to re-sort a list produced by
Return value is similar to
None by default
Daniel Podolsky, <email@example.com>
Copyright (C) 2006 by Daniel Podolsky, <firstname.lastname@example.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.