1

I have an FME workbench which reads all of the TAB files in a folder and all of the subfolders and writes the paths of those TAB files as well as their type (NATIVE, RASTER, etc) to an Excel file.

The folder is a published parameter. What I would like to do is name the Excel file the same as the rightmost folder (I'm not sure what you'd call this) in the parameter.

For example, when the workbench is run, the user selects this folder:

C:\Temp\ABC\DEF\GHI

The excel file would be GHI.xlsx

or if the user selects this folder:

C:\Folder\ABC\DEF123

The excel file would be DEF123.xlsx

I have tried many different ways to get this folder name. I tried creating a new parameter that builds the name but no luck. I've also tried setting the parameter as an attribute using the parameterFetcher then using the SubstringExtractor. However, I can't seem to get the start and end index set properly. This is what I've got in my substringExtractor:

enter image description here

2

Try using the FilenamePartExtractor transformer instead...

It "Extracts a part of a filename path and returns the result as a string."

That should do it. ;)

  • Perfect! I can't tell you how much time I spent trying to work this one out. Too many transformers... – Fezter Dec 11 '13 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.