Skip to main content

Hi there,

I am trying to digest multiple CSV files from within a certain directory. To do this, I have created a CSV Reader that has a Source CSV folder with the parameter: _"<my file path>\\*.csv"_.

I need to remove the processed file from this directory after processing which I would do via python shutdown script by getting the filename that has to be removed (actually - it would be moved into a directory).

In the past when I only processed one file, I was able to grab the file location directly from the reader, which is of course now the <filepath>*.csv .

I have used an Attribute-Exposer to get the filename- but I haven't figured out how to use it in my shutdown script? Am I missing something obvious here? Is there a way to either:

- set a Python variable with the filename (I would be surprised)

or

- set a publish parameter at run-time?

Thanks in advance!

I have done this using the FileCopy Writer using the fme_basename attribute that contains the file name and path. In that case there is no need for Python.


Hi @robopetr

There is no possibility to retrieve attribute values in the shutdown script. You can however use parameters using the list FME_MacroValues['name_parameter']. The path can be retrieved and all csv-files can be fetched using this path.

Another solution is to expose the fme_ feature_type (so you get the name of every file) and make sure that one of the features (for example using a sampler grouped by the feature_type) is sent to a pythoncaller. Using FeatureHolders you can make sure this pythoncaller is only executed at the end.


I have done this using the FileCopy Writer using the fme_basename attribute that contains the file name and path. In that case there is no need for Python.

A cleaner and easier solution.

 

I would go for this one ;)

 

 


I have done this using the FileCopy Writer using the fme_basename attribute that contains the file name and path. In that case there is no need for Python.

yes much better and you keep the overview of actions in the workspace and not "hidden" in the shutdown script

 

 


Reply