Folder capture in a subprocess gets all TXT files in a folder and, as it is supposed, repeats actions for each file in that folder. One of those actions can, in some cases, generate a new TXT file in that same folder that should be processed as it was there in the first place.
Unfortunately, Folder capture does not see that new file and ignores it. Can I force Folder capture to scan folder content again and process all files?
A folder capture task starts by taking a snapshot of the files to capture. It then kicks off a loop to process all the files in the snapshot. Once the loop is complete for all files, control returns to the Folder Capture task one last time to check if any new files that match the mask are available. If there are, then a new snapshot is taken and the procedure is repeated once more.
This could theoretically go on forever, so you have to be careful how you build your process if it adds files to the Folder that is being monitored.
So you don’t need to do anything to force a rescan of the hot folder, the task does it automatically. I have tested it here and it works just fine. I created a simple calling process:
And then a subprocess that adds a single text file to the monitored folder:
OK, I found a bug and it’s on your side
- Add two TXT files to the folder
- Add folder capture on “*.txt” pattern
- When Folder capture captures the first file delete the second one
- Add a new TXT file in the same folder (name different then deleted one)
- Folder capture does not find that new file
That’s a significantly different process than the one you described initially.
I tested it here and yes, the fact that you’re deleting the second file confuses the the Folder Capture because it becomes unable to complete the loop on the snapshot it initially took.
You should instead store the name of the file to delete in a variable, and then, immediately after the Folder Capture task, check the filename being processed against that variable. If both values match, the condition just does nothing (i.e. deletes the file) and the Folder Capture can proceed happily.