12

How can I perform a command on the selected items ?

for example calling vim, or gimp for the 5 text or image files selected.

I tried to make use of the inlined command line at the bottom, but it doesn't take my selection into account

2 Answers 2

15

For one-liners, use %t at the command line, which gets substituted for a list of your selected items.

for F in %t; do echo "${F} is selected"; done
cp %t /var/somewhereelse/
1
  • Use %f macros as a substitute of current selected file name. Example: vim %f.
    – alexcloud2
    Jul 23, 2022 at 11:39
10

Press F2 for user menu and then choose Do something on tagged files or press @. In popup window you can provide your command.

It is important to notice that for each file command will be executed separately. It will be something like:

for file in files:
   COMMAND file

not

COMMAND file1 file2
2
  • this also works when the cursor is on a file but it is not selected Mar 27, 2015 at 16:34
  • the selected item is automatically appended to the command.
    – weberjn
    Aug 29, 2018 at 14:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .