1File::DirList(3)      User Contributed Perl Documentation     File::DirList(3)
2
3
4

NAME

6       File::DirList - provide a sorted list of directory content
7
8       Version 0.04
9

SYNOPSIS

11           use File::DirList;
12           #
13           my @list = File::DirList::list('.', 'dn', 1, 0);
14

DESCRIPTION

16       This module is used to get a list of directory content.  It is a simple
17       wrapper around DirHandle and sort()
18
19       The module has two methods:
20
21       "list($dirName, $sortMode, $noLinks, $hideDotFiles, $showSelf)"
22           Produces a list, accepting 5 parameters:
23
24           $dirName
25               Name of the directory to list
26
27           $sortMode
28               Describes how list should be sorted.
29
30               This is a string containing the following symbols, with
31               uppercase representing the reverse sort:
32
33               "d" or "D"
34                   "Directory" sort. 'd' means all the directories will
35                   precede files, 'D' means reverse.
36
37               "n" or "N"
38                   Sort by file (or subdirectory) name.
39
40               "i" or "I"
41                   Same as 'n' but case insensitive.
42
43               "m" or "M"
44                   Sort by modification time.
45
46               "c" or "C"
47                   Sort by creation time.
48
49               "a" or "A"
50                   Sort by access time.
51
52               "s" or "S"
53                   Sort by size.
54
55               $sortMode is interpreted from left to right. If the first
56               comparison produces an equal result next one is used. For
57               example, string "'din'" produces a list with all the
58               directories preceding files, directories and files are sorted
59               by name case insensitively, with lowercase letters preceding
60               upper case.
61
62           $noLinks
63               If "true" symbolic links will not be examined. Set it on
64               platforms without symlink support.
65
66           $hideDotFiles
67               If "true" 'dot' files will not be reported.
68
69           $showSelf
70               If "true" '.' directory entry will be reported.
71
72           Returned value is an array reference, sorted as described by
73           $sortMode.
74
75           Array elements are array references representing an item.
76
77           The individual item's array contains 17 elements:
78
79           "[0..12]"
80               Result of stat() for this item. For valid symbolic links, the
81               stat of the target item is returned.
82
83           "[13]"
84               Name of the item.
85
86           "[14]"
87               Is item a directory? Contains 0 for non-directory items, 1 for
88               directories, 2 for '..', 3 for '.'.  Used by "d or D" sorting.
89
90           "[15]"
91               Is item a link? 0 for non-links, 1 for valid links, -1 for
92               invalid links.
93
94           "[16]"
95               Link target. "undef" for non-links, target path for links.
96
97           [15] and [16] are set to non-link if $examineLinks is "false".
98
99       "sortList($list, $sortMode)"
100           Used to re-sort a list produced by list()
101
102           Parameters are
103
104           $lis
105               Reference to a list produced by list()
106
107           $sortMode
108               Sorting rules.
109
110           Return value is similar to list()
111
112   EXPORT
113       None by default
114

SEE ALSO

116       DirHandle, stat, lstat, sort
117

AUTHOR

119       Daniel Podolsky, <tpaba@cpan.org>
120
122       Copyright (C) 2006 by Daniel Podolsky, <tpaba@cpan.org>
123
124       This library is free software; you can redistribute it and/or modify it
125       under the same terms as Perl itself, either Perl version 5.8.4 or, at
126       your option, any later version of Perl 5 you may have available.
127
128
129
130perl v5.38.0                      2023-07-20                  File::DirList(3)
Impressum