I'm using Ranger file manager.
I want to move selected (mark
ed) directories to the path provided.
I've been moving directories using dd
and pp
but it requires the user to go to the destination directory to "paste" them into.
There's a undocumented move
command which I don't know how to use.
And I also guess it may be done through external shell command somehow, but I want to do it natively through the move
command.
Best Answer
I never needed ranger's native
move
command with being able to use themv
command on the ranger command line, to move the selected file or directory to a given directory, e.g.:where
%f
is the ranger macro for highlighted files, and%s
would be for all the selected.The option
-f
forks the operation so that the ranger session is not interrupted by a long file process.You can summon the comand line with s, ! or @.
Another way, especially if you have many copies/moves to make, is to open another tab in ranger, with
gn
and cd to the directory you want to copy/move the files to. Then return to the first tab to select files and use the ranger macro for the next tab%D
, to move files to, like,But that actually only saves you from hitting
yy Tab dd Tab
. To be honest I usually switch tab anddd
.I set up key-bindings in the rc.conf file like so,
Note that
%S
is the macro for the selected files on the next tab.%d
is the macro for the directory path of current tab.And some others,
Where
%c
is the ranger macro for files held in the copy/cut buffer.Files are easily added to the buffer with
yy
, to yank, orya
, to add to the copy buffer. Similarly, withdd
, to cut, orda
, to add to the cut buffer.See my other key-mappings here