Execute batch operations using xplr

Often times you need to run a command on multiple files, and often, multiple commands on multiple files.

It's possible to do it entirely in the command-line, using tools like xargs, and basic shell scripting, but xplr provides a more intuitive and interactive experience, using a plugin called map.xplr.

map.xplr demo

To use this, you need xplr and map.xplr installed. See the official install instructions.

Once installed, you can navigate to any directory, focus on the target file or select multiple files, and then press M. You will see a prompt where you can enter any command you want to run, and the file paths will be passed as arguments to the command. In case you want to run the command separately on each file, or maybe, you want to pass the paths multiple times to the same command, just press tab. It will drop you into the "map multi" mode, where you can type the command, and pass the file paths by using {} as the placeholder.

If you want to execute a more customized version of the operation, for example, you may want to run a slightly different command on a specific file, press ctrl-o. This will create a shell script containing the command and file paths that you see on screen, and open an editor to let you edit the commands interactively. Once you save and exit the script, you will be back to the xplr screen with the option to either cancel the operation by pressing escape or execute it by pressing enter.

UPDATE: New in v0.3.4

In v0.3.4 you can use and define more placeholders such as {name} {ext} {mime} etc. in the multi map mode. With this feature, you can better organize your files.


Follow xplr.stck.me for more xplr related tips & tricks.

Write a comment ...

xplr

Show your support

If you want to see more tutorials, please consider supporting the project.

Recent Supporters

Write a comment ...

xplr

Pro
Learn xplr - A hackable, minimal, fast TUI file explorer