Search code examples
bashshellfindargumentsexec

find: missing argument to -exec


I was helped out today with a command, but it doesn't seem to be working. This is the command:

find /home/me/download/ -type f -name "*.rm" -exec ffmpeg -i {} -sameq {}.mp3 && rm {}\;

The shell returns

find: missing argument to `-exec'

What I am basically trying to do is go through a directory recursively (if it has other directories) and run the ffmpeg command on the .rm file types and convert them to .mp3 file types. Once this is done, remove the .rm file that has just been converted.


Solution

  • I figured it out now. When you need to run two commands in exec in a find you need to actually have two separate execs. This finally worked for me.

    find . -type f -name "*.rm" -exec ffmpeg -i {} -sameq {}.mp3 \; -exec rm {} \;