List Directory
Description
The List Directory command will list all the files in a given path. If the path is a file, then only the details for that file are given. If the path contains wildcards, then the files matching the pattern will be returned.
IMPORTANT: List Directory (L path) lists all files that match the given path without interruption. If a directory is large, this can be difficult to manage. In that case, use LS path to begin a directory listing iteration process, then use LI pattern to iterate through the listings.
Format
L path | Full listing, no interruption |
LC path | Count of all files matching path |
LS path | Starts a List Directory iteration |
LI pattern | Iterates through a directory listing, returning the next file that matches pattern. |
Notes
For L path and LC path, path can also contain wildcards (“?” and “*”).
In LS path, path can not contain wildcards, and must be a directory.
pattern is required for LI pattern. To list all files, use “*” to match everything.
Parameters
pathis the absolute path to a file/directory. A properly formatted path must begin with a “/” (forward slash) and begins at the root directory. Subdirectories are separated with “/” (forward slash).- e.g.
/logs/january/jan3.log
- e.g.
pattern- a filename pattern which can contain wildcards (“?” and “*”).
Response Format
«SP»response | Success - below |
Enn | An error occurred |
response has one of two formats based on the “L” setting.
L = 0:
«sp»D | ss..sss filename1«cr»
D | ss..sss filename2«cr»
...
D | ss..sss filenameN«cr»
where:
Dindicates a directoryss..sssis the size of the filefilenameNis the filename or directory name
L = 1:
«sp»DRHSA yyyy/mm/dd hh:mm:ss ss..sss filename1«cr»
DRHSA yyyy/mm/dd hh:mm:ss ss..sss filename2«cr»
...
DRHSA yyyy/mm/dd hh:mm:ss ss..sss filenameN«cr»
where:
DRHSAare the attributes for the file. If the attribute is not set, the value is “-”.Dindicates a directory.yyyy/mm/dd hh:mm:ssis the modification date of the file/directory.filenameNis the filename or directory name
Example
“L” setting = 0:
“L” setting = 1:
Using wildcards:
File count (with wildcard):
Iteration example: