cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
JojoRadio
Level I

Adding extension to file name from path

I've never worked with file paths before.

I have multiple columns that determine the name of certain subfolders in a location on my computer.

I created a column that stitches multiple values from columns, to generate the appropriate file path as such:

 

 

"C:\MainFolder\Subfolder1\Subfolder2\" || :Subfolder3 || "\" || :Subfolder4 || "\" || :FileName

The only issue that remains is adding the appropriate extension to the end of the file name (.abc or whatever it may be).

 

Is there a way to match the file name that I have in my columns, to the file name on my computer, and have it auto-complete by adding the extension at the end?

 

This is probably not the correct technique to search for a file, so having a more complex code will be welcomed as well.

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Adding extension to file name from path

You canuse Files In Directory() to get list of files in the directory and then loop over that list until you find a match (if there can only be one match, you can use Break() to break out of the loop when the match is found). In simple cases to look for a match you could use for example Starts With() function and if the matching has to be more complicated, you could use Regex(). See Scripting Index for more examples of these functions.

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Adding extension to file name from path

You canuse Files In Directory() to get list of files in the directory and then loop over that list until you find a match (if there can only be one match, you can use Break() to break out of the loop when the match is found). In simple cases to look for a match you could use for example Starts With() function and if the matching has to be more complicated, you could use Regex(). See Scripting Index for more examples of these functions.

-Jarmo