Skip to main content
  • I am using a python caller to read paths for files from my Input folder.
  • Files in the input folder are ordered in a ClassName and AssetName folders. There is a variable number of AssetName folders under each class name folder.
  • I am transforming data and using a schema mapper to read transformed schema
  • A series of shapefiles is written with a dynamic writer.

How can I copy the input ClassName and Asset Name folder structure when writing the output ? 

I tried using shp dataset fanout but I can’t get the configuration right.

Hi ​@tsirkuse I wonder if you can construct the path string from getting the ClassName and the AssetName folders out of the path read. You cold then construct the destination string and use that in a filecopy writer
FILECOPY: a "Hello World" example please | Community

Hope that helps.


 

Hi ​@tsirkuse I wonder if you can construct the path string from getting the ClassName and the AssetName folders out of the path read. You cold then construct the destination string and use that in a filecopy writer
FILECOPY: a "Hello World" example please | Community

Hope that helps.

Hello there, 

 

Thanks for your answer ! I have the parameters and the full path constructed, and did some trial with file copy and trying to pass some of the destination path to the writer but so far without success. 

The input of my workflow is DWG and the output is SHP. I could write the Shapefiles a first time and then move them to the relevant folder with File Copy but I was wondering if there is a better way of doing this. 


It would be much easier to answer your question if we knew what you’ve tried. Can you post a sample workspace, or if that isn’t feasible, some screenshots?

Also, have you considerd using the Directory and File Pathnames Reader rather than a Python script to list the input files?

https://docs.safe.com/fme/html/FME-Form-Documentation/FME-ReadersWriters/path/path.htm

https://support.safe.com/hc/en-us/articles/25407595670541-Using-the-Directory-and-File-Pathnames-Reader-Record-File-Metadata


The input is not the problem. I can change it by a PATH reader and a feature reader.

It’s just the python script produces my transformed attributes at once and was pre-existing.

If I activate dataset fanout with @ClassName and @AssetName the output files are not created anymore. I only get empty folders… Without changing anything and deactivating the fanout, all files are normaly outputed.


Hi ​@tsirkuse I saw a post on GIS Stack Exchange and thought it was very similar to this.

In the description I noticed that the concatenation would not create the right folder structure.

For the dynamic output folder

For the individual shapefiles the name is set to: @Value(Prefix)_@Value(Basename) .

Fanout Directory= \output\temp Fanout Dataset=@Value(folder_location)@Value(folder_level) In this the folders are created but the dataset is not created.

 

I would put an attribute creator right before your writer and create the fanout path there. Then use that attribute for your fanout path. Be sure to create the path in the text editor as 

c:\psomefoldername]\@Value(folder_location)\@Value(folder_level) Be sure to add the backslash between the two attributes. or C:\rpath]\aattribute]\uattribute] .Hope that helps.


Hi ​@tsirkuse I saw a post on GIS Stack Exchange and thought it was very similar to this.

In the description I noticed that the concatenation would not create the right folder structure.

For the dynamic output folder

For the individual shapefiles the name is set to: @Value(Prefix)_@Value(Basename) .

Fanout Directory= \output\temp Fanout Dataset=@Value(folder_location)@Value(folder_level) In this the folders are created but the dataset is not created.

 

I would put an attribute creator right before your writer and create the fanout path there. Then use that attribute for your fanout path. Be sure to create the path in the text editor as 

c:\psomefoldername]\@Value(folder_location)\@Value(folder_level) Be sure to add the backslash between the two attributes. or C:\rpath]\aattribute]\uattribute] .Hope that helps.

Hi,
Thanks for your reply ! I have tried this before, and again now, it doesn’t work. It creates NULL folders in my basefolder, and puts all the files inside.


Reply