That’s one way to do it, and that’s what @Kazimierz has demonstrated.
Another way would be to define the path before even reading the file. I mean when you are reading your input file, you need to go somewhere. Then why not define this as a variable before hand and re-use this variable for output path after?
In fact, this can easily be achieved using the Create File/Folder Variables node:
It’s literally made for purpose of creating variables to hold folder and file names/path. It will generate variables of type path for you
@mosmel After adding some nodes to workflow, variable ports are hidden by default. To unhide variable ports one needs to right-click appropriate node and select Show Flow Variable Ports option.
Please remember to mark the solution that match your expectations by clicking ‘Solution’ button.