<file action="file_action"
path="file_path"
type="file_type"
charset="charset_of_text_file"
listdirs="listdirs"
listfiles="listfiles"
listrecursive="listrecursive"
listfilter="listfilter">
body defining content of the file if action="write" or action="append"
</file>
| Name | Required | Default | Description |
|---|---|---|---|
| action | no | read | Defines file action. Valid values are read, append, write and list. |
| path | yes | File path, relative to the working directory. | |
| type | no | text | Type of file: text or binary. |
| charset | no | [Default charset for config] | Charset for text files. Has no effect if type is binary. |
| listdirs | no | yes |
Tells whether to list directories (action = list).
|
| listfiles | no | yes |
Tells whether to list files (action = list).
|
| listrecursive | no | no |
Tells whether to recursively search directories (action = list).
|
| listfilter | no |
Filename pattern to search for (* is replacement for any sequence, ? for any character).
Works only for action = list.
|
<file action="write" path="123.txt">
<file action="read" path="1.txt"/>
-----------------------------------
<file action="read" path="2.txt"/>
-----------------------------------
<file action="read" path="3.txt"/>
</file>
Here, new file is created containing appended contents of three existing files, separeted with lines.
<file action="write" path="c:/images/alljpegs.zip" type="binary">
<zip>
<loop item="filename">
<list>
<file path="c:/images/" action="list" listfilter="*.jpg" />
</list>
<body>
<zip-entry name="${sys.getFilename(filename.toString())}">
<file type="binary" path="${filename}"/>
</zip-entry>
</body>
</loop>
</zip>
</file>
ZIP file consisting of all JPEG images taken from specified directory is created.