print("\\Clear"); run("Close All"); dir = getDirectory("temp"); //create a sample tiff virtual stack run("T1 Head (2.4M, 16-bits)"); File.makeDirectory(dir + "t1-head/"); run("Image Sequence... ", "format=TIFF save="+ dir + "t1-head/"); close(); print("Folder:" + dir); //outputs 'C:\Users\steinr\AppData\Local\Temp\' run("Image Sequence...", "open=" + dir + "t1-head/ sort"); print("Title:" + getTitle); //outputs 't1-head' //the image is correctly made from the last subpath //replace backslashes with forward slashes to avoid double escaping dir = replace(dir, "\\", "/"); print("Folder:" + dir); //outputs 'C:/Users/steinr/AppData/Local/Temp/' run("Image Sequence...", "open=" + dir + "t1-head/ sort"); print("Title:" + getTitle); //outputs 'C:/Users/steinr/AppData/Local/Temp/t1-head' //the image title now incorrectly includes the full path