cancel
Showing results for 
Search instead for 
Did you mean: 

Copy files from one location to other with changes into naming

munish
New Contributor

I am trying to transfer all files in folder from one location to other. If I did simply as below screenshot then it works
Capture

But as per my scenario I need to change filename and path in-between, so I changed it to below pipeline but it only export one file (1st file) not for all files in folder.
Capture1

Please advice, how can I export all files.

3 REPLIES 3

alchemiz
Contributor III

Hi Munish,

Good day, what I will do is use a mapper (change input/output view to binary) that will receive the binary from the multi-reader from this mapper it will also update the binary header property content-location which you can use in the file writer

image

You can also use your pipeline, in the JSON formatter add a binary header property content-location

e.g.
image

then in the file writer you can then use the binary header property content-location

Thanks,
EmEm

alchemiz
Contributor III

BTW, the filename that you will assign needs to be unique for each streaming document otherwise it will be overwritten by the next streaming document and you will end up just a single file (the last document file to stream)

for unit testing, probably you can use Math.randomUUID() as Date.now formatted to milliseconds sometimes overlaps and might cause duplicate filenames

munish
New Contributor

Thanks for response. question was it was not working with multiple files trasfer/copy, I got it worked, there is a property need to enable in json formatter snap that default is false.

thanks