3

I need the following behavior. If user selects one or more *.mp3 files and hits Enter the list of files is saved to ~/Documents/mp3log.log.

I guess I need to set open with to a custom bash script, but what should this script contain?

1 Answer 1

2

That's a simple task, you just need to “open” the file(s) with an executable script like this:

#!/bin/bash
echo $@ >>~/Documents/mp3log.log
for i in "$@"; do
  xdg-open "$i"
done

xdg-open "$@" may be a better alternative for the loop if you want to deal with just a single file type here – of course you can also skip xdg-open and open it directly with the desired program, e.g. vlc "$@".

To run the selected files through the script by default just make it the default for the desired file type using your file manager.

You must log in to answer this question.

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