Directory | Searches a specified directory and provides files, matching a specific search-pattern. |
The Directory Node is used to iterate over files contained in the specified directory (Path). The URI output property returns the URI to a file in the directory that matches the SearchPattern which can be changed to the next file via the Next method.
If the AutoUpdate property is activated, a separate thread will be started in the background to check the directory every 100ms for any changes. As an alternative, the Update method can be triggered to check for changes manually.
The SearchPattern is directly based to the .NET framework and therefore follows the syntax described in MSDN: Directory.GetFiles Method. Two wildcard characters are supported, ? to match exactly zero or one character and * to match zero or more characters. The SearchPattern cannot contain two periods followed by a directory separator (i.e. ..\). Subfolder defines whether to include the subfolders in the search.
Examples:
*.txt data/image*.jpg
The properties SortMode and SortBy allows sorting of the results by name, size and date of the found file items.
Natural Sort
Most of the Sort Modes are selfexplaining but Natural Sort is worth explaining.
Let us do a simple example:
Image1 Image2 Image3 ... Image10 Image11 Image12
A normal sort would result in
Image1 Image10 Image11 Image12 Iamge2 Image3...
whereby a natural sort sorts it in a way a human would expect it
Image1 Image2 Image3 ... Image10 Image11 Image12
Natural Sorting depends on the System Language and therefore can differ from one System to another.
You may choose to search the folder asynchronously with the ASync flag. When done the node will either fire the Loaded or Failed Event depending on the result of the search.
The output property ResultArray returns a string array containing all found file URLs. This property can be used for manual iteration (see Array Indexer Node). If no matching files have been found, the array will be empty.