Solved

Write multiple files in the same directories where source files are lcoated

  • 23 June 2020
  • 4 replies
  • 22 views

Hi, I need to write the results of multiple files (let´s say raster data like .jpg) from multiple folders including subfolders into their source directory/folder...I can´t get it working with the proposed solution from this similar question here: https://knowledge.safe.com/questions/108973/write-file-in-the-same-directory-where-source-file.html. It seems that it does not work if I am recursing through subfolders.

 

 

Does anyone have a solution?
icon

Best answer by jdh 23 June 2020, 17:09

View original

4 replies

Badge +10

So you have a structure like

filepath/sourcefolder/subfolder1/image1.jpg

filepath/sourcefolder/subfolder2/image2.jpg

filepath/sourcefolder/subfolder1/subfolder2/image.jpg

 

And you want to write all the files into filepath/sourcefolder?

Badge +22

The featureWriter solution should work.

Something like expose fme_dataset on the reader, FilenamePartExtractor to get the dirpath.

 

 

Use _dirpath as the dataset on the featureWriter, and the new filename as the Raster Filename. Make sure that the Raster Filename is not the same as the original data or Bad Things Happen.

Hi, no the results need to be in exactly the same folders where the source files are, like this:

filepath/sourcefolder/subfolder1/image1_new.jpg

filepath/sourcefolder/subfolder2/image2_new.jpg

filepath/sourcefolder/subfolder1/subfolder2/image_new.jpg

 

The featureWriter solution should work.

Something like expose fme_dataset on the reader, FilenamePartExtractor to get the dirpath.

 

 

Use _dirpath as the dataset on the featureWriter, and the new filename as the Raster Filename. Make sure that the Raster Filename is not the same as the original data or Bad Things Happen.

Hi, thx that was exactly what I am looking for and it´s working the proposed way!

Exposing the fme_dataest in combination with the FilenamePartExtractor and the FeatureWriter is something I would not have come up quickly with by myself.

Thx a lot!

Reply