Get File Names
Description
Get File Names is a step in the Input Plugin for Process Studio Workflows. The Get File Names step is used to get information associated with files on a specified path (with filters) in the file system. The associated information includes, short_filename - only the filename, without the path (somefile.txt), path - only the path (e.g. /tmp/), type, exists, ishidden, isreadable, iswriteable, lastmodifiedtime, size, extension, uri, rooturi. The retrieved files along with associated information are added as rows onto the stream.
Configurations
| No. | Field Name | Description |
|---|---|---|
| Filename is defined in field | Enable checkbox if filename is defined in a field.If this is checked the following four fields are activated. | |
| 1 | Get filename from field | Specify the field from which to retrieve the filename |
| 2 | Get wildcard from field | A File can be selected using regular expressions. This field specifies a wildcard for the regular expression. Wildcard you would have a RegEx with something like .*\.dat$ If incorrect regex is specified then ‘Regex pattern is incorrect so no files will be retrieved’ message is displayed. |
| 3 | Exclude wildcard field | Specify a wildcard to exclude for the regular expression. |
| 4 | Include subfolders | Include files from the folder and sub-folders. |
| 5 | File or Directory | Specify the file or directory selection. |
| 6 | Regular Expression | Provide a regular expression to search files. |
| 7 | Exclude Regular Expression | Provide a regular expression to exclude files. |
| 8 | Selected files | This is a tabular list of files selected. |
| 9 | Show filenames button | Click this button to see what the filename looks like after selecting all the previous settings. |
| Filter Tab: | ||
| 1 | Get | Filter the retrieved file names based on by choosing an option from the list: - All files and folders - Files only - Folders only |
| 2 | Include a row number in the output | Enable checkbox to include a row number in the output. |
| 3 | Rownum fieldname | Specify a fieldname for holding rownum. |
| 4 | Do not report error on no files or folders | Enable this checkbox not throw error on no files or folders. |
| 5 | Limit the number of rows returned | Specify a value to limit the number of rows returned to this value. |
| 6 | Add the filename(s) to the result list | Enable checkbox to add the filename(s) to the result list. |
Note: The output fields for this step are:
- filename - the complete filename, including the path (/tmp/somefile.txt).
- short_filename - only the filename, without the path (somefile.txt).
- path - only the path (e.g. /tmp/)
- type
- exists
- ishidden
- isreadable
- iswriteable
- lastmodifiedtime
- size
- extension
- uri
- rooturi
- If you have no files then the step(and the workflow) do not abort. If you want to abort the workflow you could use a ‘Detect Empty Stream’ step with some logic.
Secondly, you could also check for no files and abort within a process by the 0 Checks If Files Exist process entry.