To start with, I've read related subjects, but none of them has explained my doubts.
I have a following command which works fine:
find ./source/ -maxdepth 1 -type f ! -name "secretinfo.md" -exec cp {} ./build/ \;
However, using ;
means that I'm passing every found file to the cp command one by one. I thought I could pass them all at once as cp command allows that. Based on other answear that I've found:
A -exec command must be terminated with a ; (so you usually need to type \; or ';' to avoid interpretion by the shell) or a +. The difference is that with ;, the command is called once per file, with +, it is called just as few times as possible (usually once, but there is a maximum length for a command line, so it might be split up) with all filenames
Since that's what I did:
find ./source/ -maxdepth 1 -type f ! -name "secretinfo.md" -exec cp {} ./build/ +
And here I'm getting an error:
find: missing argument to `-exec'
Can you explain to me why this is not allowed?