So I added two separate UpdateAttribute processors.
First one creates field folder: ${path:substringAfter("/input/"):substringBefore("*")}
Second one create field path.new: /output/${folder}
And then in the PutSFTP I change the Remote Path property to ${path.new}/
This also lets me get subdirectorys and files from there correctly if needed.