> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kasoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# fileListDir

> 列出目录内容，并可选择按文件名掩码过滤结果。

列出指定路径中的文件和目录。

## 必需的参数

* **path**: 将列出其目录和文件的完全限定路径（例如，`/tmp/mydirectory`）。

## 可选的参数

* **mask**：用于过滤结果条目的模式。 默认为`*`。 例如，掩码`*.json`匹配所有具有`.json`扩展名的文件。
* **recurse**：是否递归列出条目。 允许的值为`false`和`true`。 默认为 `false`。
* **fileordir**：是否仅列出文件或目录。 允许的值为`all`、`files`和`dirs`。 默认为`all`。

## 输出属性

* **file:fullname**: 当前条目中文件或目录的完整路径。
* **file:name**: 当前条目中文件或目录的名称。
* **file:mtime**: 当前条目中文件或目录的写入时间。
* **file:ctime**: 当前条目中文件或目录的创建时间。
* **file:atime**: 最近一次读取或写入当前条目中的文件或目录的时间。
* **file:attributes**: 当前条目中文件或目录的属性列表。
* **file:extension**: 条目的扩展名。
* **file:size**: 文件大小，以字节为单位。
* **file:isdir**: 条目是文件还是目录。

## 示例

```xml theme={null}
<!-- Setting the path to monitor on the input item -->
<arc:set attr="input.path" value="/tmp/timesensitive" />
<!-- Enabling recursion to check all subdirectories within the input path -->
<arc:set attr="input.recurse" value="true" />
<!-- Checking for files only, across all directories found by the operation -->
<arc:set attr="input.fileordir" value="files" />
<!-- Calling the operation and passing in the input item and setting an output item -->
<arc:call op="fileListDir" in="input" out="result" >
  <!-- Executing an expression that checks each file creation date in each directory -->
  <arc:if exp="[result.file:ctime | dateadd('day', 1) | datediff | lessthan(0)]" >
    <!-- If it is older than 1 day, log an entry in the application log -->
    <!-- This can be expanded to add more logic such as sending an email using appSendEmail -->
    <arc:set attr="_log.info" value="The file [result.file:name] located at [result.file:fullname] has been idle within [input.path] for longer than 1 day." />
  </arc:if>
</arc:call>
```
