Linked Questions

2
votes
1answer
930 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 ...
1
vote
0answers
144 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 ...
32
votes
3answers
27k 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 ...
31
votes
4answers
15k 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 ...
32
votes
2answers
5k 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 ...
17
votes
5answers
30k 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" ...
15
votes
4answers
16k 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
1k 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
7k 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
778 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
362 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 ...
1
vote
1answer
392 views

Command not working when run from cron [closed]

I can successfully run this command in the terminal: find /home/www/files/1 -type f -name '*' -mtime +180 -exec rm {} \ However when I add it as a cron job like so: */5 * * * * find /home/www/files/...
0
votes
2answers
798 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
0
votes
1answer
367 views

Openssl on files found with find unix command

I can find the files I'm looking for with something like this: find . -name "*.mp3"; What I want is something like this: find . -name "*.mp3" -exec openssl enc -e -aes-256-cbc -in path/to/file.mp3 ...
1
vote
1answer
207 views

Move specific directories from certain depth

I've tried to make a bash script that will help me move specific subfolders from my folder. The issue is,in the main folder photos I have folders named like this: 1,2,3,4,5,6,7,8,9,0 and inside them ...

15 30 50 per page