A
A
andreyqin2015-08-25 10:25:01
linux
andreyqin, 2015-08-25 10:25:01

Why doesn't find work with xargs?

Hello.
There is a project build script in Jenkins, the following command is called there:

call(['find', '/path/to/site', '-type', 'd', '-exec', 'chmod', '755', '{}', ';'])

Everything would be fine if it weren't so slow. Found another solution:
call(['find', '/path/to/site', '-type', 'd', '|', 'xargs', 'chmod', '755'])

But it throws an error:
find: paths must precede expression: |
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

What is the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ruslan Fedoseev, 2015-08-25
@martin74ua

maybe because | no one to process? in the first case you call one command, in the second you call two commands through the pipeline...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question