extract the folder name from file directoryHow 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
Automation and ScriptingRe: extract the folder name from file directoryThis 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";
Re: extract the folder name from file directoryLink 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/highlight/true#M67228
xx="C:\temp\myfile.txt";
theDirectory = Substr( xx, 1, Length( xx ) - Length( Word( -1, xx, "\/" ) ) - 1 );<BR /><BR />//"C:\temp"