Skip to main content
Solved

How to reference parent directory of $(FME_MF_DIR)?

  • Apr 12, 2018 6:28 PM UTC
  • 3 replies
  • 149 views

makt
Contributor
Forum|alt.badge.img+1

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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

fmelizard
Safer
Forum|alt.badge.img+22
  • Safer
  • Best Answer
  • Apr 12, 2018 8:57 PM UTC

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
  • Apr 12, 2018 8:59 PM UTC

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
Safer
Forum|alt.badge.img+22
  • Safer
  • Apr 12, 2018 9:23 PM UTC
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.