How to write a file in local fs with specific filename

How to write a file in local fs with specific filename

By default, when you write some file using de destination node “local fs” like this

the output file will have some UUID in the filename. This is necessary for internal streamsets functionality but we can change it.

In order to prevent this, we’ll add an event output to the local fs enabling the event production

and we’ll add a shell executor

With this node, we can execute shell code after the file has been close. For renaming the output file, we can add some variable from parameters and event data.

 

We’ll use the FILEPATH and FILEOUTNAME (from parameter) and then we’ll write the code for renaming the file in the script

 

#!/bin/bash echo $FILEPATH mv $FILEPATH /tmp/out/2021-04-08-10/$FILEOUTNAME.csv exit 0