Disclaimer: I am a novice to Unix/Linux, but I am looking forward to learning! I have tried a search on this stackexchange and read the the man find
, but I can't seem to figure this out.
I want to use the find ... -exec {} +
command to recursively find all files with a particular file extension and run a command on the list of files. There are approximately 100k files that I need to convert. The command that I am running accepts the filename (or a list of filenames, eg f1 f2 f3
) as a parameter, but I also need to specify additional parameters to run the command.
What I tried so far:
This works:
find . -iname "*.extension" -exec <command> {} <additional parameters> \;
This doesn't seem to work:
find . -iname "*.extension" -exec <command> {} <additional parameters> +
I get the error message, find: missing argument to '-exec'
. I am guessing that I cannot specify additional parameters after the {}
?
Some notes:
The command in question takes the filename as the first parameter, and then I need to designate some additional parameters, such as the output directory -o <outputDir>
and the variables to extract from the files -v <var1,var2,...>
.
I am running this on the terminal in Ubuntu 12.04, if that makes any difference.
<command>
? You might want to fix its odd syntax first as it breaks the POSIX Utility syntax guidelines. (All options should precede operands on the command line.) – jlliagre Jun 11 '13 at 23:31<command>
is to be replaced by the actual command I'm using, such asls
orrm
. In my case, it is a tool that converts from one file format to another, and it does not actually have<
or>
in the call. – ialm Jun 12 '13 at 16:13