Next: , Previous: Run Commands, Up: Actions

3.4 Delete Files

— Action: -delete

Delete files or directories; true if removal succeeded. If the removal failed, an error message is issued.

The use of the ‘-delete’ action on the command line automatically turns on the ‘-depth’ option (see find Expressions). This can be surprising if you were previously just testing with ‘-print’, so it is usually best to remember to use ‘-depth’ explicitly.

If ‘-delete’ fails, find's exit status will be nonzero (when it eventually exits).