exec command

CJ Tres ctres at grics.net
Sat Jan 14 13:28:21 UTC 2012

On 01/14/2012 05:42 AM, PleegWat wrote:

> You need to terminate the argument to -exec with a ;, which needs to
> be quoted or escaped for the shell, and you need to include an
> argument of {} which will be replaced by the name of the file find has
> found. You also seem to have confused the argument order to find.
> find $path -type f -iname '*.html' -exec rm -rf {} \;
> Here you should fill your path for $path.
> Specifically when deleting files, you may also use the find action
> - -delete, which has the same effect as -exec rm:
> find $path -type f -iname '*.html' -delete
> This version should be faster when a lot of files need to be deleted.

Yes, thanks, much simpler.
I've run it on a single folder in a sub directory as a test.
It eliminated the majority of the files but another issue has cropped up.
All the files are of the "HTML document (text/html)" type, but not all 
have html or .html in the file name. In fact there is nothing else 
common to all files - within their names -that need to be deleted and 
there is a single plain text document in each folder that needs to be 
excluded from the -delete command.
I'm guessing the answer to this in in man find or some other man page?

More information about the ubuntu-users mailing list