Skip to main content
Solved

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


andre_parplies
Participant
Forum|alt.badge.img

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?

Best answer by jdh

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.

View original
Did this help you find an answer to your question?

4 replies

ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • June 23, 2020

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?


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • June 23, 2020

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.


andre_parplies
Participant
Forum|alt.badge.img

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

 


andre_parplies
Participant
Forum|alt.badge.img
jdh wrote:

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!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings