
Envoyé par
jlliagre
Hmm, tu es sûr ?
Ben... non... 
1 2 3 4
| $ find . -name "*.jpeg" -exec mv {} ./bkp_Photos/ '+'
find: paramètre manquant pour «*-exec*»
$ find --version | head -1
find (GNU findutils) 4.7.0-git |
J'ai toujours beaucoup de mal à faire marcher _mon_ find avec '+' alors qu'avec ';' y a pas de problème 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| $ find . -name "*.jpeg" -exec echo mv {} ./bkp_Photos/ '+'
find: -exec: no terminating ";" or "+"
$ find . -name "*.jpeg" -exec echo mv {} ./bkp_Photos/ +
find: -exec: no terminating ";" or "+"
$ find . -name "*.jpeg" -exec echo mv {} ./bkp_Photos/ \+
find: -exec: no terminating ";" or "+"
$ find . -name "*.jpeg" -exec echo mv {} ./bkp_Photos/ \;
mv foo.jpeg ./bkp_Photos/
mv bar.jpeg ./bkp_Photos/
$ find --version
find: illegal option -- -
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]
$ uname -a
Darwin MBPR15-jack 15.6.0 Darwin Kernel Version 15.6.0: Mon Jan 9 23:07:29 PST 2017; root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64 |
Hum... je crois que j'ai trouvé (rtfm...): 
$ man find
-exec utility [argument ...] {} +
Same as -exec, except that ``{}'' is replaced with as many pathnames as possible for each invocation of utility. This behaviour is similar to that of xargs(1).
1 2
| $ find . -name "*.jpeg" -exec echo mv {} +
mv foo.jpeg bar.jpeg |
Manifestement, il faut que "{}" soit juste avant "+", ce qui est le cas, par exemple, pour un "grep" où l'on veut voir le nom des fichiers:
$ find . -name "*.txt" -exec grep "chaine" {} +
Mais apparemment il ne peut pas expanser "{}" avec la liste des fichiers s'il y a autre chose derrière.
Je ne vois donc pas comment faire un mv *.jpeg ./bkp_Photos/ en un seul "mv" avec "find"... 
Mais la solution avec / et ';' tient toujours:
find . -name "*.jpeg" -exec mv {} ./bkp_Photos/ ';'
Partager