Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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 for my attempt to rename some files:

find . -name ic_launcher.png -exec mv {} other_name.png /;

Can somebody tell me, what bash does miss, and why this command isn't successful?

share|improve this question

marked as duplicate by Gilles bash Mar 28 at 22:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Are you really putting /; at the end? If so, try \; instead. – D_Bye Jul 23 '12 at 9:32
By the way find has -delete option. There is no need in -exec rm {} \;. – rush Jul 23 '12 at 9:39
Backslash and slash are not the same thing at all. Backslashes lean backwards: \\ , Forward slashes, or just slashes, lean forwards: /. In Unix, slashes are generally path separators, while backslashes are generally used for quoting / escaping. – jw013 Jul 23 '12 at 12:19
@jw013 sorry about that! I was actually misreading it, most likely because I found so many examples that use the slash instead of the backslash. In fact the manpage is right! – Rafael T Jul 23 '12 at 12:39
Wherever you found those examples that used the wrong slash must not be a very good resource. I would recommend not going there for examples anymore. – jw013 Jul 23 '12 at 12:44
up vote 14 down vote accepted

The semicolon at the end needs to be quoted or escaped so that it is passed to find instead of being interpreted by the shell.

find . -name ic_launcher.png -exec mv '{}' other_name.png ';'


find . -name ic_launcher.png -exec mv '{}' other_name.png \;

should do what you're trying to do.

share|improve this answer
nice. It works for me. Why I have to quote it? – Rafael T Jul 23 '12 at 9:40
That's because the shell might want to expand {} and interpret ; as a command separator. – Wojtek Rzepala Jul 23 '12 at 9:48
It's almost never necessary to quote {}. There was actually an entire question about that, but I can't find it because the site can't search for {}. The issue is the /; typo in the original question. – jw013 Jul 23 '12 at 12:17
Found it: modern shells don't require quoting {}. – jw013 Jul 23 '12 at 12:28
@jw013 That is a very fair point. I guess I usually tend to go for something that will definitely work. And after having experienced issues with no quoting, I usually quote the braces. Possibly a bit too much for my own good. – Wojtek Rzepala Jul 23 '12 at 15:19

use Pipe like the example below:

find . -name 'spam-*' | xargs rm

share|improve this answer
that is a workaround to do what I which, but no answer on what I miss. I will use your solution for now, but I'd still like to know what I miss on the find command – Rafael T Jul 23 '12 at 9:38
Are you quoting the * wildcard? find . -name "*.png" will find all png files in or below the current dir, without those double quotes the shell will expand the * so you'll find all png files with the same name as one in the current dir - probably not what you meant. – Bristol Jul 23 '12 at 13:29
If you use xargs in combination with find, use -print0 etc. to sanitize against blanks etc. in filenames, so in general it is much more easy to use -exec instead, or, for rm, just -delete. – user unknown Jul 23 '12 at 14:49
While this may help to do what the OP is trying to do, it does not at all answer the question that was asked. – killermist Jul 23 '12 at 19:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.