path1 = gg.getFile() dir1 = '' for txt1 in string.gmatch(path1, '[^/]*/') do dir1 = dir1 .. txt1 end print(dir1)