How to use automator to create a service which converts an ebook (using calibre commands) I am trying to figure out a way to be able to right-click on an .epub file and convert it to a .mobi file. Currently (thanks to calibre command tools) I can to the following within the terminal

ebook-convert test.epub test.mobi


So  the fist file name test.epub is the original, existing file, and the second file name test.mobi is that it will be converted to.

Is it possible to create a service from automator which could allow we to right-click on the original test.mobi file and then just convert it?

Thanks
Open Automator, choose the service template, change "Service receives selected" to "files or folders", add a Run Shell Script action, change "Pass input" to "as arguments", and change the command to:

for f;do /Applications/calibre.app/Contents/MacOS/ebook-convert "$f" "${f%.*}.mobi";done




Or if you add

2mobi() {
  for f; do
    /Applications/calibre.app/Contents/MacOS/ebook-convert "$f" "${f%.*}.mobi"
  done
}


to a shell configuration file like ~/.bash_profile, you can run 2mobi /path/to/file.epub in a shell.