On Thu, Nov 12, 2020 at 08:51:22PM +0100, Paul de Weerd wrote:
> Hi all,
>
> I misread find(1) and did:
>
> [weerdpom] $ find path/to/cam -name \*.JPG -exec cp {} path/to/store +
> find: -exec no terminating ";" or "+"
Not really what you're asking for, but...
What you seem to want to do can be done with
find path/to/cam -name '*.JPG' -exec sh -c 'cp "$@" path/to/store' sh
{} +
Or, with GNU coreutils installed,
find path/to/cam -name '*.JPG' -exec gcp -t path/to/store {} +
>
> That was somewhat surprising - there is a terminating "+". The error
> really is that the "+" doesn't follow immediately after the "{}"
> (which the manpage of course told me). Although it would be nice to
> be able to use tools like cp and mv to -exec with +, I suspect there
> to be dragons. So I'm proposing to change the error to point this out
> to the unsuspecting user.
>
> Cheers,
>
> Paul 'WEiRD' de Weerd
>
> Index: function.c
[cut]
I quite like Alexander's proposed smaller diff.
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.