So let’s say you just ran Picasa, Google’s new aquisition, and it displays all your pictures great. It’s actually a reall neat little application, pretty slick.
However, it is not so slick that it can’t help but leave a (hidden) “Picasa.ini” file in every directory it finds images in. That is mostly fine, except for how it also indexes everything, including directories under source control (CVS).
So, whipping out trusty cygwin (could also do it using Explorer Search feature…), I try $ find . -name "Picasa.ini" -exec rm {}/;
Results without the space:
$ find . -name "Picasa.ini" -exec rm {}/;
find: missing argument to '-exec'
Frustrating.
Solution:
You MUST include a space between the {} and the /;. If you don’t you will get the missing argument error. If you put the space in, you will successfully delete every Picasa .ini file.
$ find . -name "Picasa.ini" -exec rm {} /;
Bonus:
From j0hnny
Picasa is an ‘Automated Digital Photo Organizer’ recently aquired by Google. This search allows the voyer to browse directories of photos uploaded using the picasa software.
8 responses to “find: missing argument to -exec (remove Picasa.ini files)”
Hi,
as you suggested, i tried like this writing in a “Delete.sh” file.
–>To delete directories older than 2 days in /sunith/sub1/*
#!/bin/bash
$ find /sunith/sub1/* -type d -mtime +2-exec rm -rf {} \;
when runned i get the following problem:
find: missing argument to `-exec’
can you resolve this for me
Thanks and Regards,
Sunith
Sunith,
It looks like you’re trying to delete ALL directories older than 2 days that are contained in /sunith/sub1/. Is that correct?
If that’s what you want to do, I would suggest the following fix to your command:
Inside your Delete.sh file:
#!/bin/bash
find /sunith/sub1/* -type d -mtime +2 -exec rm -rf {} \;
Key things to look for:
– Make sure that in your bash shell script you don’t put in the
$
in front of thefind
command.– Make sure that there is a space before the
-exec flag
(it looks like in your comment that there isn’t one).– Make sure you have a space before the final escaped semicolon. Also keep in mind that on Windows systems (running Cygwin) the escape character is a / (forward slash), and on Unix type systems the escape character is a \ (back slash).
I hope this helps.
Hi,
I tried writing this way in my bash shell script:(Delete.sh)
#!/bin/bash
find /sunith/sub1/* -depth -type d -mtime +2 -exec rm -rf {} \;
But i am here with the same problem.
when runned i get the following problem:
find: missing argument to `-exec’
can you resolve this for me
Thanks and Regards,
Sunith
Sunith,
What do you get when you run just this command from the command line?
find /sunith/sub1/* -depth -type d -mtime +2
hi,
thank you,
when i run at command line:
$find /sunith/sub1/* -depth -type d -mtime +2
the results are fine, i.e, I can see the sub folders in /sunith/sub1/ which are older than 2 days.
But when i put the same command i am not getting the results till morning.
Now it is working fine in my bash scripting file.
But why was that happen for the last time, and with out changing any thing it is performing fine. how is that…
will be there any malfunctioning of bash..
Thanks and Regards,
Sunith
This was just what I was looking for. Thanks!
I have a same problem:
When I executed this line:
find /archive/expfiles/archivelogs -type f -mtime +13 -exec rm {} ;
on the command line, it works fine
but when I placed it in a bash script file and tried executing the script, it gives error:
find: missing argument to '-exec'
I have not been able to resolve this for the last couple of months now so I really need some gurus out there to point to me why my find command could not run as a script.
Cruzo
I guess you are missing a backslash before the semicolon in the end of line. Why don’t you try with
find /archive/expfiles/archivelogs -type f -mtime +13 -exec rm {} /;
Cheers,
Emil