cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Steffen_Bugge
Level IV

Access to folder above main script

I am currently using the Get Default Directory function to run a script in a subfolder of my main script, using the following code

 

relativePath = Get Default Directory();

Include(relativePath || "Folder1/Data import.jsl");

How can I run a script or open a file in a folder above my main script, i.e. in a directory higher than the full directory given by Get Default Directory function?

1 ACCEPTED SOLUTION

Accepted Solutions
mmarchandTSI
Level V

Re: Access to folder above main script

This should work for you.

 

Names Default To Here( 1 );
relativePath = Get Default Directory();
UPone = Left( relativePath, Contains( relativePath, "/", -2 ) );

View solution in original post

3 REPLIES 3
mmarchandTSI
Level V

Re: Access to folder above main script

This should work for you.

 

Names Default To Here( 1 );
relativePath = Get Default Directory();
UPone = Left( relativePath, Contains( relativePath, "/", -2 ) );
Steffen_Bugge
Level IV

Re: Access to folder above main script

Thanks for the reply @mmarchandTSI !

 

This takes me one level up, but what if I need two levels up?

Steffen_Bugge
Level IV

Re: Access to folder above main script

relativePath = Get Default Directory();
UPtwo = Left( relativePath, Contains( relativePath, "/Folder1/", -2 ) );

Thanks again @mmarchandTSI, I solved it with the above code.