It is often useful to read a local or network directory and populate a PhixFlow stream with the names of the files. This can be used as a reference list for subsequent processing and can also form the basis of a duplicate detection pattern, ensuring that files are not processed mor more than once. The examples below show how to read the entire folder contents, as well as just speciifc specific file types.The model for these examples is 004 Read a List of Files in a Directory
Example 1: Read all files
...
- Add a File Collector to the model and confiure configure it as follows:
- Source Type = Specified Directory
- File Type = File Details Only
- File Location Strategy = All Files in Folder
- Input Directory Expression = Enter the name of the folder relative to the Import File Locaion Location in System System Configuration. Put the folder name in double quotes e.g g. "Data Files"
- File Pattern Expression = ".*." (This will read all file types)
- Make sure the Enabled and Allow on-Schedued Scheduled collection checkboxes are checked and then save and close the file colletorcollector
- Hover over the file collector and select Add a New Stream
- Add an attribute to the stream to hold the fie name and enter the expression "in._fileName" without the quotes.
- Run analysis on the stream and view the filenames
File Collector Configuration
Attribute Expression to Read Filename
...
Example Folder and Results in PhixFlow
...
- Copy the file collector and stream using the following steps:
- Hold down down shift and selecting the two objects by left-clicking on them
- Select Copy Selected Object
- Modify the Input Directory Expression on the new stream to to ".*.csv" (This will read all files of type csv)
- Make sure the Enabled is checked is checked and then save and close the file collector
- Run analysis on the stream and view the filenames for the csv files
Copying Multiple PhixFlow Objects
Modified Expression to read just the CSV files
...
Mode Ref: 004
Related articles
Filter by label (Content by label) | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...