File::DirList(3pm) User Contributed Perl Documentation File::DirList(3pm)
NAME
File::DirList - provide a sorted list of directory content
Version 0.04
SYNOPSIS
use File::DirList;
#
my @list = File::DirList::list('.', 'dn', 1, 0);
DESCRIPTION
This module is used to get a list of directory content. It is a simple wrapper around
DirHandle and sort()
The module has two methods:
"list($dirName, $sortMode, $noLinks, $hideDotFiles, $showSelf)"
Produces a list, accepting 5 parameters:
$dirName
Name of the directory to list
$sortMode
Describes how list should be sorted.
This is a string containing the following symbols, with uppercase representing the
reverse sort:
"d" or "D"
"Directory" sort. 'd' means all the directories will precede files, 'D' means
reverse.
"n" or "N"
Sort by file (or subdirectory) name.
"i" or "I"
Same as 'n' but case insensitive.
"m" or "M"
Sort by modification time.
"c" or "C"
Sort by creation time.
"a" or "A"
Sort by access time.
"s" or "S"
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.
$noLinks
If "true" symbolic links will not be examined. Set it on platforms without symlink
support.
$hideDotFiles
If "true" 'dot' files will not be reported.
$showSelf
If "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:
"[0..12]"
Result of stat() for this item. For valid symbolic links, the stat of the target
item is returned.
"[13]"
Name of the item.
"[14]"
Is item a directory? Contains 0 for non-directory items, 1 for directories, 2 for
'..', 3 for '.'. Used by "d or D" sorting.
"[15]"
Is item a link? 0 for non-links, 1 for valid links, "-1" for invalid links.
"[16]"
Link target. "undef" for non-links, target path for links.
[15] and [16] are set to non-link if $examineLinks is "false".
"sortList($list, $sortMode)"
Used to re-sort a list produced by "list()"
Parameters are
$lis
Reference to a list produced by "list()"
$sortMode
Sorting rules.
Return value is similar to "list()"
EXPORT
None by default
SEE ALSO
DirHandle, stat, lstat, sort
AUTHOR
Daniel Podolsky, <tpaba AT cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Daniel Podolsky, <tpaba AT cpan.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.
perl v5.30.3 2020-09-22 File::DirList(3pm)
Generated by $Id: phpMan.php,v 4.55 2007/09/05 04:42:51 chedong Exp $ Author: Che Dong
On Apache
Under GNU General Public License
2025-11-21 17:26 @216.73.216.164 CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)