Linked Questions

3
votes
1answer
998 views

Quoting curly braces in the shell [duplicate]

I found examples of different quoting for curly braces for find, but I could not find an explanation. The possible choices are: 1. {} 2. '{}' 3. "{}" And they all seem to work fine. Is ...
2
votes
0answers
477 views

find -exec {} vs. find -exec '{}' [duplicate]

I noticed in the man pages for find, that the {} always have single quotes around them. find -exec '{}' \; The description states: Notice that the braces are enclosed in single quote ...
1
vote
1answer
311 views

find -exec cat {} code injection [duplicate]

I was reading the man of find on the -exec command {} switch section, it states that the {} should be quoted to protect from interpretation by shells. I'm trying to reproduce such a behaviour locally ...
0
votes
1answer
106 views

Can anyone help me figure out what this “find” command with curly braces is saying? [duplicate]

I found some old notes where someone suggest I run the following command to set some file permissions: find /perl/lib/ -type f -exec chmod o+r \{\} \; Would you happen to know what the \{\} part of ...
0
votes
0answers
30 views

Difference between {} and '{}'? [duplicate]

I alsmost always use {} when using find -exec command {} instead of '{}' but I don't know what's the difference if there's any between the two. It's just my curiosity making me wonder.
33
votes
3answers
32k views

How can I use two bash commands in -exec of find command?

Is it possible to use 2 commands in the -exec part of find command ? I've tried something like: find . -name "*" -exec chgrp -v new_group {} ; chmod -v 770 {} \; and I get: find: missing ...
37
votes
4answers
17k views

find -exec + vs find | xargs: which one to choose?

I understand that the -exec can take a + option to mimic the behaviour of xargs. Is there any situation where you'd prefer one form over the other? I personally tend to prefer the first form, if ...
40
votes
3answers
8k views

Is there a reason why ls does not have a --zero or -0 option

This question was prompted by questions about ls' -1 option and the recurring tendency of people to ask question and answers that includes processing the output of ls. This reuse of the output ls ...
20
votes
5answers
45k views

How do I perform an action on all files with a specific extension in subfolders in an elegant way?

My current best bet is: for i in $(find . -name *.jpg); do echo $i; done Problem: does not handle spaces in filenames. Note: I would also love a graphical way of doing this, such as the "tree" ...
23
votes
4answers
26k views

How to delete files only, but keep the directory structure?

I would like to delete every file, but keep the folder structure. Is there a way? NOTE: (I'm using GNU bash 4.1.5).
6
votes
3answers
2k views

find -exec not working in fish

While using fish as my shell, i'm trying to set permissions on a bunch of c source files in current dir with find . -type f -name "*.c" -exec chmod 644 {} +; I get an error find: missing ...
6
votes
2answers
8k views

missing argument to find -exec [duplicate]

I want to remove certain files using find and -exec. But unlikely bash tells me, that I'm "missing" some argument. find . -name *.png -exec rm {} /; what do I miss? same "missing argument" return ...
6
votes
4answers
1k views

how to delete all files with specific extension in specific named folders in large tree?

I have large tree, with many pdf files in it. I want to delete the pdf files in this tree, but only those pdf files in sub folders named rules/ There are other type of files inside rules/. The rules/ ...
3
votes
3answers
415 views

Use find to execute series of commands

I want to examine a directory and execute a command for each matching folder. The following find correctly returns the list I'm looking for. find . -maxdepth 1 -name "*.bitbucket" For each item ...
0
votes
2answers
1k views

mv files older than 8 days in ksh script [closed]

need to create script in KSH to mv files to other directory in same server older than 8 days they all .CSV

15 30 50 per page