args Path, Name
local hwnd = win.handle("c=TTOTAL_CMD")
local Slash
if(select(Path, 2) == "\\") do
	Slash = "Script works only in directory tree, not network or special folders"
	messagebox("ok error", Slash, "TreeUp Script")
	quit
endif
Path = file.folder(Path)
Slash = revindex(Path, "\")
if(Slash) do
	Name = file.nametype(Path)
	Path = file.folder(Path)
else
	Slash = "First folder in root visited. Go to the previous drive?"
	if(messagebox("yesno warning", Slash, select(Path, 2) ++ " root") == 7)
		quit
	win.sendmessage(hwnd, 0x400+51, 2052, 0)		
	win.sendmessage(hwnd, 0x400+51, 2001, 0)		
	quit
endif
for(1)
;Sub_TreeUpCmd - имя скрипта TreeUpCmd 
	Slash = runfile.Subs\Sub_TreeUpCmd(Path, Name)
	if(not Slash) do					
		tc.cd(hwnd, Path)
		keys {home}
		quit
	endif
	if(Slash != Name) do					
		Path = Path ++ "\" ++ Slash
		break
	endif
	Name = file.nametype(Path)
	Path = file.folder(Path)				
endfor								
for(1)
;Sub_LowestDirCmd - имя скрипта LowestDirCmd 
	Slash = runfile.Subs\Sub_LowestDirCmd(Path)
	if(not Slash) do										
		tc.cd(hwnd, Path)
		keys {home}
		quit
	endif
	Path = Slash
endfor