Why does find -exec mv {} ./target/ + not work?

前端 未结 5 955
青春惊慌失措
青春惊慌失措 2020-12-12 08:37

I want to know exactly what {} \\; and {} \\+ and | xargs ... do. Please clarify these with explanations.

Below 3 commands run

5条回答
  •  余生分开走
    2020-12-12 09:32

    no, the difference between + and \; should be reversed. + appends the files to the end of the exec command then runs the exec command and \; runs the command for each file.

    The problem is find . -type f -iname '*.cpp' -exec mv {} ./test/ \+ should be find . -type f -iname '*.cpp' -exec mv {} ./test/ + no need to escape it or terminate the +

    xargs I haven't used in a long time but I think works like +.

提交回复
热议问题