I am importing multiple file from using import function. I want to save it automatically outside the folder and with same name.
I assume you want to save files found from Sample Data folder into single JMP table named Sample Data.jmp which is on the same level as the folder.
Names Default To Here(1); xlsx_dir = "$DOWNLOADS/JMP example/Sample data/"; dir = Convert File Path(xlsx_dir, posix); dts = Multiple File Import( // will return a list <<Set Folder(xlsx_dir), <<Set Excel Best Guess(0), <<Set Excel Has Headers(0) ) << Import Data; dt = dts[1]; // basically you should end up with just a single file // drop 1 level lower in path root_dir = Word([1 -2], dir, "/\") || "/"; foldername = Word(-1, dir, "/\"); dt << Save(root_dir || foldername || ".jmp");
Modify as needed, this provides some ideas on how to "traverse" the directory path using Word()
Thanks for the explanation. I worked fine.
I was able to get file name but was strugalling with saving it.
//File name=reverse(words(dir,"/"))[1];//dt << Set Name(wafer);
Word(-1, str,) is basically same as Reverse(Words(str))[1]. Learning how to utilize both Word and Words can be very helpful (and sometimes Item and Items())
Names Default To Here(1); my_str = "http://www.jmp.com"; r1 = Word(-1, my_str, ":/."); r2 = Reverse(Words(my_str, ":/."))[1]; Show(r1, r2);