Choose Language Hide Translation Bar
Highlighted
Dib-Dey
Level III

How to generate directory using JSL

I can generate the current directory using following:

 

cur_path = Substr( Get Default Directory(), 2, 999 );
cur_dir = Substitute( cur_path, "/", "\" );

 

Now, I want to generate directory two directory up. Can one help how to do it?

 

I was trying following. But it is giving me an error.

list_dir = Words(cur_dir, "\");
nt = N Items(list_dir);
_path_to_include = "";
For( i = 1, i <= nt-2, i++,
	_path_to_include = _path_to_include + list_dir[i] || "\",
);
show(_path_to_include);

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dib-Dey
Level III

Re: How to generate directory using JSL

cur_path = Substr( Get Default Directory(), 2, 999 );
cur_dir = Substitute( cur_path, "/", "\" );
list_dir = Words(cur_dir, "\");
nt = N Items(list_dir);
_path_to_include = "";
For( i = 1, i <= nt -2 , i++,
	_path_to_include = _path_to_include || list_dir[i] || "\";
);
show(_path_to_include);

View solution in original post

1 REPLY 1
Highlighted
Dib-Dey
Level III

Re: How to generate directory using JSL

cur_path = Substr( Get Default Directory(), 2, 999 );
cur_dir = Substitute( cur_path, "/", "\" );
list_dir = Words(cur_dir, "\");
nt = N Items(list_dir);
_path_to_include = "";
For( i = 1, i <= nt -2 , i++,
	_path_to_include = _path_to_include || list_dir[i] || "\";
);
show(_path_to_include);

View solution in original post

Article Labels