$file.ls
Returns a directory listing
Usage
<array> $file.ls(<directory:string>,[<flags:string>[,<namefilter:string>]])
Description
Returns the listing of the specified directory as an array.

The <directory> should be given as a UNIX style path and is adjusted according to the system that KVIrc is running on.

<flags> may be a combination of the following characters:

d: list directories
f: list files
l: list symbolic links
r: list readable files
w: list writable files
x: list executable files
h: list hidden files
s: list system files
n: sort files by name
t: sort files by file time
b: sort files by file size
z: put the directories first, then the files
k: invert sort order
i: case insensitive sort
If <flags> is empty, then a default of dfrwxhs is set. If none of the r,w,x flags are set then KVIrc sets all of them by default.

If <namefilter> is passed then it is interpreted as a wildcard string that must match the entries to be returned.
Examples

%dir[]=$file.ls(/,"d")
foreach(%f,%dir[])echo %f
%dir[]=$file.ls(/usr/include,"f","t*.h");
foreach(%f,%dir[])echo %f
%dir[]=$file.ls($file.homedir,"dfr");
foreach(%f,%dir[])echo %f

Index, Functions