Skip to main content
Solved

How to reference parent directory of $(FME_MF_DIR)?


makt
Contributor
Forum|alt.badge.img+1
  • Contributor

If $(FME_MF_DIR) references "C:/project1/overview/tasks", is there a simple way to reference one directory up, ie: "C:/project1/overview" ? The way I am thinking is to process $(FME_MF_DIR) with some string functions, based on occurrences of the slash - is this the best way forward, or is there is more elegant or simple solution?

Thanks

Best answer by fmelizard

Hi @makt You could use a ParameterFetcher followed by a FilenamePartExtractor to get one directory up as an attribute.

View original
Did this help you find an answer to your question?

3 replies

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • Best Answer
  • April 12, 2018

Hi @makt You could use a ParameterFetcher followed by a FilenamePartExtractor to get one directory up as an attribute.


makt
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • April 12, 2018
fmelizard wrote:

Hi @makt You could use a ParameterFetcher followed by a FilenamePartExtractor to get one directory up as an attribute.

Thanks Dan,

 

In the meantime, I also figured out another way via PythonCaller using the syntax seen here: https://stackoverflow.com/questions/2860153/how-do-i-get-the-parent-directory-in-python

 

 

 

 


fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • April 12, 2018
makt wrote:
Thanks Dan,

 

In the meantime, I also figured out another way via PythonCaller using the syntax seen here: https://stackoverflow.com/questions/2860153/how-do-i-get-the-parent-directory-in-python

 

 

 

 

@makt A ParameterFetcher shouldn't be necessary. If you want to reference the up directory throughout the workspace then put your Python code into a private Scripted Python Parameter.

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings