Skip to main content
Solved

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

  • June 23, 2020
  • 4 replies
  • 123 views

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.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

ebygomm
Influencer
Forum|alt.badge.img+46
  • 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+40
  • 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

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!