從檔案目錄中提取資料夾名稱如何從文件目錄中提取資料夾名稱? 儲存時我會使用資料夾的名稱作為資料表的名稱。 我正在使用 JMP 15。
我嘗試了在這裡看到的這段程式碼,但仍然無法提取資料夾名稱。 我
Dir = "";
p = pick Directory("Select a Folder", Dir);
f = Files In Directory(p);
Dir = Substr( p, 1, Length( p ) - Length( Word( -1, p, "\/" ) ) - 1 );前任。
文件路徑:C:\Users\Animals
目錄=動物
自動化和腳本編寫回覆:從檔案目錄中提取資料夾名稱這應該回傳 Animals(至少 JMP17 是這樣)
Names Default To Here(1);
dir = "C:\Users\Animals";
foldername = Word(-1, dir, "\");
show(foldername); // foldername = "Animals";
回覆:從檔案目錄中提取資料夾名稱連結到(其中之一)原始帖子:
https://community.jmp.com/t5/Discussions/extracting-the-directory-of-a-jmp-file-in-JSL/mp/423133/highlight/true#M67228
xx="C:\temp\myfile.txt";
theDirectory = Substr( xx, 1, Length( xx ) - Length( Word( -1, xx, "\/" ) ) - 1 );<BR /><BR />//"C:\temp"