let OutConnections: Connection[] = flowElement.getOutConnections();
for (const connection of OutConnections) {
if (job.isFile() === true) {
job.log(LogLevel.Info,[Connection path on disk]);
job.sendTo(connection);
}
}
Why do you need this? By using sendTo like you are doing the output job ends up in the correct location. Displaying the location in a message does not really add value.
For input jobs you can get the path because there it makes sense: you may have to read the job input file or search for something in a job input folder.
Side remark: testing if a job is a file inside the loop is not efficient because it is always the same condition with the same result, but perhaps this is just part of a test.
The sendTo functions are not executed immediately. There can be multiple of them in a script and they are all gathered until the end of the script. Suppose you had access to the path of the outgoing connection and there were no files in the folder. Testing the number of files in the outgoing folder after a send, even multiple ones, would always return 0.
Do not misunderstand me, I am not saying that having access to the outgoing folder path cannot be interesting: "Hold job" has some interesting functionality that relies on that knowledge, but in that case the number of files is checked before sending. I still do not see the use case for knowing how many files there are after sending. There is perhaps an alternative way of achieving the same goal, but then you will have to describe what the goal is.