Skip to main content
Hi, 

 

 

I have a list of filenames that are located within a specific directory.  The list of filenames is generated within the FME workbench.  What is the best way to get the Reader to read in only the files within the larger directory?  Note: the files that I want to read in are within a number of sub-directories, which I don't know what they are. I only know the root directory.

 

 

Thanks,
Hi,

 

 

use the Text File reader, followed by the FeatureReader (http://docs.safe.com/fme/html/FME_Transformers/Default.htm#Transformers/featurereader.htm) transformer.

 

 

David
or using the advanced brouwser, with the subdirectories option on.....

 

or using the Directory and File Pathnames + FeatureReader......
As the filenamelist is generated within a workbench you could use a workbenchcaller to call a "readerworkbench" to add a Reader for the format you wish to read set to the rootdirectory and read subdirectories. 

 

The reader workbench must be set up with dynamic schema and when finished clear the reader content so it says "not set". Then it is a workspacecaller only bench.

 

This way you can pick items from a directory without knowing beforehand if it's their at all. (unlike the featurereader)

 

 

Because i don't see option to use attributes or parameterselection for items in a directory (not without having to go trough the motion manualy first at least)
I've found the "Directory and File Pathnames" reader, but as my list is not an external data source, but a list that I have generated within the workbench itself, how do I get it into the reader?
..hhmm..is see i did make a workspacerunner calling a reader with a featurereader in it.

 

I paramatrised the dataset attribute so you could indeed enter a list separated by ";".

 

You could build this list using a concatenator.

 

 

The parameters for this reader are set in the navigator panel.

 

 

I use a bogus creator as a initiator.

 

 

"FeatureReader reader":

 

 

 

and the workspacecaller to call it:

 

 

 

though format is empty it will be filled at calltime.

 

 
Thanks Gio, if possible I would like to do this without using a Workspace Runner.  Could anyone elaborate on how using the TextFile Reader + FeatureReader Transformer, or Directory and Filepath Reader + FeatureReader Transformer methods?

 

 

Where/how do I input the filenames in the text file so that only those listed are output from the FeatureReader?
As you generated the filenames in the reader you don't need to use a textfilereader or pathreader..

 

 

As i understood it, and it is explained in

 

http://blog.safe.com/2011/05/fmeevangelist78/

 

 

You coudl just attach a FeatureReader .

 

 Select the root directory and enter a File/Filter like "*.txt" (or whatever type you need).

 

Select "query the feature specified in the attribute below" and select the attribute  with the filenames (multiple filenames need to be conctenated with a colon ":" )

 

 

However when i enter a single filename like "F1.txt" or "H:\\F1.txt" (wich i copied from the directory to read it from) it does  not read the file.....

 

I also tried concatenated filenames...no dice.

 

Either im doing something wrong or it does'nt work.

 

 

 

seems somethings are repaired in fme2015(?)
Thanks Gio, I tried concatenating with a colon ":" but I also could not get it to work.  Should the attribute simply contain:  "filenameA:filenameB:filenameC"?

 

 
Hi,

 

 

I tried different variants, but can't get it to work either. It does not even find a file when i have the featurereader read all the files....

 

 

 

Reply