Lists files and directories based on specified criteria.
listfiles, lstfil, lf, ls, find, dir
lf [<options>] [ " <pattern> " [ " <directory> " [ ( <condition> ) ] ] ]
-r Recursive. Finds files in the specified directory as well as all subdirectories.
-g Go around errors. With this option, if any errors are encounterd, the command will
keep going and will NOT list errors. Without this option, the command will stop at
the first error and will list that error. Of course, an error that prohibits this command
from continuing its operation will stop the command and that error will be listed
in either case.
-t List file type.
-c List creation time.
-a List latest access time.
-m List latest modification time.
-s List size in bytes.
-n List name.
If no options are specified, all attributes are listed.
<pattern> A pattern that is to be matched with the file and directory names.
The star character ( * ) can be used as part of the
pattern to indicate that any number of any characters
can match the star.
Pattern can be specified as a string constant or as a string
variable. If str constant is used, use of double quotes around it
Pattern can also be specified as an expression. If so, use
parentheses around it to indicate that this expression needs to
be evaluated before passing its value as an argument to this command.
If <pattern> is not specified, it is assumed to be "*".
That means all files and directories are listed.
<directory> The name of the directory where the search will be initiated.
It can be specified using relative or absolute (full) path. If <directory> is not
specified, current directory is used.
We highly recommend enclosing the <directory> in double quotes.
If a root directory is specified for this argument, it must end with a slash (/),
such as "C:/" or "M:/".
<condition> Condition can be any expression resulting in a bool value.
This expression is evaluated against each file and directory encountered.
If the expression evaluates to true, that file or directory is listed.
If <condition> is not specified, everything is listed.
We recommend generous use of parentheses in specifying the
<condition>. There is no limit on how many parentheses you can
use. Furthermore, there is no limit on how many levels of
parentheses you can use.
The following system variables are available to be used in the <condition>.
$ftype Type. Can be one of the following.
f Flat file
$fatime Access time.
$fctime Creation time.
$fmtime Modification time.
All times are in the format - yyyymmddhhMMss.
The lower case mm is month. The upper case MM is
minute. The hour (hh) is in 24 hour format.
$fsize Size in bytes.
Please note that all of these variables are set for each file and directory found,
irrespective of which listing options are specified. The listing options
merely dictate the format of the output listing.
Matched files/directories in the <directory> (and subdirectories,
if -r option is specified) are listed one per line.
The various fields associated with each found file are listed on one
line separated by tabs. These fields are listed in the following order.
latest modification time
latest access time
Any errors are listed here.
This command lists files and directories in the given <directory> whose names match
the <pattern> specified and whose attributes satisfy the specified <condition>.
Items in each directory (or subdirectory) are listed in increasing alphanumeric order
of item names.
Items in a directory are listed before items in its subdirectories. Subdirectory items
are listed in increasing alphanumeric order of subdirectory names.
If the file size is too large and can not be contained in the variable of type int,
the displayed (and assigned to $fsize) size is incorrect.
Sizes of directories are meaningless. So, they are shown as 0 (zero).
Colon (:) is not allowed in the <pattern> argument.
Security and other restrictions placed by the operating system may result in not being
able to access certain files and directories.
If this command is executed in/on operating system directories/files, the execution may
be very slow. Some of these files are in constant use by the operating system itself,
and the command must wait until operating system allows it access to those files.
(For files that may be constantly modified by the operating system, this wait can be
If you expect the number of files found by this command to be very large (such as for
files in operating system directories), redirect the output to a file instead of writing
it to screen. Writing large data to screen can be extremely slow. Further the screen may
chop off early parts of the output in order to maintain performance.
Will list files in the current directory that have extension .txt.
lf -r "*.aspx" "C:/myproject"
Will list all files with extension .aspx in directory "C:/myproject".
will produce error. The pattern *.cpp needs to be enclosed in double quotes
lf "*.cpp" "*.h"
will produce erroneous results. Only one pattern is allowed on lf command.
If the intention is to list files with extension of either .cpp
or .h, use the mf command instead as follows.
mf "*.cpp" "*.h"
© 2008-2013, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com.
Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.