Setting a variable to the name of the folder it is in two steps up.. [message #92583] |
Mon, 18 January 2016 19:21  |
Jake Haslemann
Messages: 1 Registered: January 2016
|
Junior Member |
|
|
Hi everyone! First Post here, so we will see how it goes.. This may or may not be a very simple question to answer, but I was wondering if anyone knew a way to set a variable to the name of the folder it is in, but two steps up in the directories.. For example, if my path reads:
jake/L100/hbetacodetemp/p45
and my idl code is located in p45...
I want to set a variable to the value "L100" or whatever that folder will be.
In other words I want to set the variable:
identifier = L100
but without typing that out explicitly, such that the code will be able to gather that for me
|
|
|
Re: Setting a variable to the name of the folder it is in two steps up.. [message #92584 is a reply to message #92583] |
Mon, 18 January 2016 21:21  |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Monday, January 18, 2016 at 8:21:15 PM UTC-7, Jake Haslemann wrote:
> Hi everyone! First Post here, so we will see how it goes.. This may or may not be a very simple question to answer, but I was wondering if anyone knew a way to set a variable to the name of the folder it is in, but two steps up in the directories.. For example, if my path reads:
> jake/L100/hbetacodetemp/p45
> and my idl code is located in p45...
> I want to set a variable to the value "L100" or whatever that folder will be.
>
> In other words I want to set the variable:
> identifier = L100
> but without typing that out explicitly, such that the code will be able to gather that for me
Take a look at the docs for the functions ROUTINE_FILEPATH and STRSPLIT, for example, http://www.exelisvis.com/docs/routine_filepath.html.
Jim P.
|
|
|