Linked Questions

6
votes
1answer
818 views

Problem combining -or and -exec with find command [duplicate]

I'm finding that when I use find's -or operator in combination with -exec, I don't get the result I expect. When searching for .cpp and .h files, the command works as expected if I don't use -exec: ...
2
votes
2answers
213 views

how can I find files based on different names and delete all them in one single line [duplicate]

Finding files based on different names I know how to do. The problem is that I don't know how delete all of them at once. I am using OMVS in z/OS390. To find files searching by different extensions I ...
0
votes
1answer
556 views

Find with multiple extension does not work with -exec [duplicate]

I am using a find command this way: find ./my_path -name "*.ext1" -exec echo {} \; And it would work. Now with multiple extensions, the following command would display several files : find ./...
1
vote
1answer
154 views

Different behaviors between find -exec and piping through xargs [duplicate]

I wanted to recursively run chmod go+w in a particular folder including hidden files, and I first tried find . -name ".*" -o -name "*" -exec chmod go+w {} \; but I found that it wasn't affecting ...
0
votes
1answer
109 views

A confusion about the parameter “-print” in the command “find” [duplicate]

I am new bee for Linux. I have a question about the command find. When I search a file under a directory, I would like to skip a sub-directory named publish find ./ -path ./publish -prune -o -iname ...
2
votes
1answer
92 views

find -exec doesn't do what find output suggests [duplicate]

If I do this find: find ${TRIADS_DIR}/*.dc.results -path "*amblock/stats.*HEAD" -o -path "*amblock/stats.*BRIK" then I get what I expect in STDOUT: tp101.day1.dc.results/amblock/stats.tp101_day1+...
1
vote
1answer
105 views

Why does GNU find suppress printing -prune'd directories when another “-or” test is applied? [duplicate]

I have a directory with the following files and a .git directory, e.g. . ├── .git │   ├── branches │   ├── COMMIT_EDITMSG │   ├── packed-refs │   └── refs ├── readme.md ├── server_build.sh └── tags ...
0
votes
0answers
40 views

find `-delete` doesn't delete files? [duplicate]

Look at this example: $ ls -l /home/kossak/.asdf/shims/gettext -rw-rw-r-- 1 kossak kossak 0 Feb 6 13:51 /home/kossak/.asdf/shims/gettext $ find ~/.asdf/shims -name 'gettext' -or -name 'gettext.sh' /...
9
votes
3answers
3k views

find: prune does not ignore specified path

I need to exclude .git from my find search. To achive that, I am using the -path ./.git -prune switch: $ find . -path ./.git -prune -o \( -type f -o -type l -o -type d \) | grep '.git' ./.git ...
4
votes
4answers
4k views

Properly escaping output from pipe in xargs

Example: % touch -- safe-name -name-with-dash-prefix "name with space" \ 'name-with-double-quote"' "name-with-single-quote'" \ 'name-with-backslash\' xargs can't seem to handle double quotes:...
0
votes
1answer
677 views

`find -type l` matches file while `-type l -o -type f` does not, but only with explicit `-print` [duplicate]

I'm using GNU's find. I've simplified my problem to this shell session: $ mkdir t $ cd t $ touch a $ ln -s a b $ find -type l ./b $ find -type l -o -type f ./a ./b $ find -type l -print ./b $ find -...
2
votes
1answer
61 views

Why does to order of the parameters affect the files found by `find`?

I found this weird behavior in find. Depending on the order of the parameters to find it finds different files. For example, I have a directory tree with the following content. . ├── configure.ac ├──...