CodyBugstein
CodyBugstein

Reputation: 23322

Shell says find: missing argument to `-exec' and no alternatives working

A backup program I used recently made duplicates of whole bunch of files throughout my computer because of some setting that I've since changed.

When the backup program made a copy, it renamed the old one original1.thefilename.extension. I'm trying to automatically delete all of these unnecessary files with a simple shell command.

 find -type f -name 'original1*' -exec rm {} \;

However, when I try to run this I get

find: missing argument to `-exec'

I've looked all over the web for a solution. I've found suggestions that I should try exec rm +, -exec rm {} +, -exec rm {} \;, -exec rm + etc. but none of them work. I am using Windows 8.1

I would really appreciate any help!

Upvotes: 1

Views: 1133

Answers (1)

GregHNZ
GregHNZ

Reputation: 8979

In Windows command shell, you don't need to escape the semicolon.

find -type f -name 'original1*' -exec rm {} ;

Your version of the command should work in a bash shell (like cygwin).

It's interesting that you get the gnu find to execute, because on my Windows 8.1 machine, I get Microsoft's find.

Upvotes: 4

Related Questions