cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Security Notice: CVE-2026-109618 and CVE-2026-109619

    JMP promptly initiated a review of its products, services, and relevant infrastructure for exposure to CVE-2026-109618 and CVE-2026-109619.

    Our assessment of JMP products has not identified exposure to these vulnerabilities. Where remediation was required within supporting environments, appropriate security updates and controls have been applied and validated.

    We have identified no evidence of successful exploitation or unauthorized access to JMP systems or customer information associated with these vulnerabilities.

    JMP continues to monitor the issue and relevant vendor guidance. No action is required by JMP customers at this time.

  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
UserID16644
Level V

extract the folder name from file directory

How can I extract the folder name from file directory? I will use the folder's name as the name of the data table when saving it. I am using JMP 15.

I tried this piece of code I saw here but still cannot extract the folder name. I

 

Dir = "";

p = pick Directory("Select a Folder", Dir);
f = Files In Directory(p);

Dir = Substr( p, 1, Length( p ) - Length( Word( -1, p, "\/" ) ) - 1 );

Ex. 

File path: C:\Users\Animals

Dir = Animals

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: extract the folder name from file directory

This should return Animals (at least it does with JMP17)

Names Default To Here(1);

dir = "C:\Users\Animals";
foldername = Word(-1, dir, "\");
show(foldername); // foldername = "Animals";
-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: extract the folder name from file directory

This should return Animals (at least it does with JMP17)

Names Default To Here(1);

dir = "C:\Users\Animals";
foldername = Word(-1, dir, "\");
show(foldername); // foldername = "Animals";
-Jarmo
hogi
Level XIII

Re: extract the folder name from file directory

Link to (one of) the original post(s):
https://community.jmp.com/t5/Discussions/extracting-the-directory-of-a-jmp-file-in-JSL/m-p/423133/hi... 

 

xx="C:\temp\myfile.txt";
theDirectory = Substr( xx, 1, Length( xx ) - Length( Word( -1, xx, "\/" ) ) - 1 );

//"C:\temp"

Recommended Articles