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

how to get file names or file path

file1 = pick file();
file_name = ...
suff = word(-1, file_name, ".")
if(suff == "txt" | file_name == “csv”, 
	open(file1), ....
);

how can i get file_name when I pick up a file?  

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: how to get file names or file path

Variable "file1" contains the path.

The filename can easily be extracted with

file_name = Word( -1, file1, "/" );

 

Jim

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: how to get file names or file path

Variable "file1" contains the path.

The filename can easily be extracted with

file_name = Word( -1, file1, "/" );

 

Jim
Rock123
Level I

Re: how to get file names or file path

I am feeling so exited to have your reply!

Rock123
Level I

Re: how to get file names or file path

If I like to get the path of file1, what shall I do? 

txnelson
Super User

Re: how to get file names or file path

I think this is what you really want

file1 = pick file();
file_name = Word( -1, file1, "/" );
suff = word(-1, file_name, ".")
if(suff == "txt" | stuff == “csv”, 
	open(file1); 
);
Jim