-- Copy with folders tree -- v1.1 local re=regex.new([[^(?:[A-Z]:|\\)(\\(?:.+\\)?)([^\\]+)$]]) local function cf(PP,AC) local res local FPath,FName = re:match(AC) if FPath and FName then local cds=PP..FPath res=win.CreateDir(cds,"t") if res then res=win.CopyFile(AC,cds..FName) if not res then far.Message(FName,"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 end return res end Macro { description="Copy with folders tree2"; area="Shell"; key="ShiftF5"; condition = function() return APanel.Format=="Branch" or APanel.Format=="Temporary panel" or APanel.Format=="LF Search: temporary panel" or APanel.Format=="Search results" end; action = function() --local ttime=far.FarClock() local t,PP,ItemsNumber = {},PPanel.Path0 if not APanel.Selected and APanel.Current~=".." then ItemsNumber=1 panel.SetSelection(nil,1,panel.GetPanelInfo(nil,1).CurrentItem,true) else ItemsNumber=panel.GetPanelInfo(nil,1).SelectedItemsNumber end for Item=1,ItemsNumber do local AC=panel.GetSelectedPanelItem(nil,1,Item).FileName local res=cf(PP,AC) if not res then break end table.insert(t,Item) end panel.ClearSelection(nil,1,t) panel.RedrawPanel(nil,1) --far.Message(far.FarClock()-ttime,"mcs") end } |