-- Copy with folders tree -- v1.0 local function cf(cds,cfs,cfd) local res=win.CreateDir(cds,"t") if res then res=win.CopyFile(cfs,cfd) if not res then res=far.Message(cfs,"Warning! File not copied",";AbortRetryIgnore","w") if res==3 then res=true else res=false end end else far.Message(cds,"Warning! Directory not created",nil,"w") end return res end Macro { description="Copy with folders tree"; area="Shell"; key="ShiftF5"; condition = function() return APanel.Format=="Branch" or APanel.Format=="Temporary panel" end; action = function() --local h=Far.DisableHistory(-1) if not APanel.Selected then Panel.Select(0,1,1,0) end local PP=PPanel.Path0 while APanel.SelCount>0 do Panel.SetPosIdx(0,1,1) Panel.Item(0,0,0) local AP,AC,res=APanel.Path0,APanel.Current if AC:match("^[A-Z]:\\") then res=cf(PP..AP:sub(3,-1),AC,PP..AC:sub(3,-1)) elseif AC:match("^\\\\") then res=cf(PP..AP:sub(2,-1),AC,PP..AC:sub(2,-1)) end if not res then break end Panel.Select(0,0,1) end --Far.DisableHistory(h) end } |