Semantics : FSListStatement
FSListStatement ::=
|
( listFiles ( { Expr } )? | listPrintFiles | ls ) ( Expr )? ( in Expr | except Expr )? ( recursive | noHidden | fileOnly | dirOnly | perFile | perDir | count | countLines | size | compressedSize | as tree | ordered ( by ( Date | size | extension ) ) )* |
The listFiles returns the result in $$fs_result ; listPrintFiles and ls are synonyms,
they print the results to the system standard output.
The search can happen in a directory or in a ZIP or TAR archive with the in clause. Multiple
file patterns can be specified, separated by comma, and so does the except clause.
These commands list and search various attributes of files and directories, such as total
number of files and directories with count , total file size with size , and total number
of lines with countLines . In most cases, they are used to list the files themselves, and the
resulted can be sorted with the ordered clause.
For list , the results in $$fs_result are different based on the operation. For normal
file listing, it is an array of strings, holding all the paths. If as tree is specified,
the result in $$fs_result is a treeNode , where each node has a "path" data member and for
directories, there is a "isDir" boolean member set to true ; this only apploies to local file
systems. For size and compressedSize , if perDir is specified, $$fs_result is an
sorted map with directory names and the results; the last entry is "TOTAL" and the total number;
otherwise it is simply an integer for the total size. For countLines , if perFile is
specified, $$fs_result is an sorted map with file names and the results; the last entry is
"TOTAL" and the total number; otherwise it is simply an integer for the total lines. For
count , $$fs_result is an array with { file-count, directory-count, total-count }.