list. Getting directory listing

^file:list[path]
^file:list[path;filter]
^file:list[path;options]   [3.4.3]

Makes up a table (object of class
table) containing columns name, dir, size, cdate, mdate and adate (prior version 3.4.3 it nontains only one name column) -containing files and directories-within specified directory-matching pattern, if specified.
The values of
dir column are equal 1 for directory entries and are equal 0 for file entries.
filter-a regular expression (see also method match of class string) used to specify a pattern for names of file to match. It could be specified as a string or regex object [3.4.0]. If filter is not specified, all files located in specified directory will be listed.

Available options:
·$.filter[filter]-a regular expression string or a regex object.  
·$.stat(true/false)-if true the columns size, cdate, mdate and adate will be filled.  

Note: without $.stat(true) the values of columns size, cdate, mdate and adate are empty.

Example
$list[^file:list[/;\.zip^$]]
^list.
menu{
   $list.name
<br />
}

Will output the names of all archives with extension
.zip, located in web-server's root directory.


Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 23.10.2013