Home UNIX Discover and Optionally Delete Files with Find Command

Discover and Optionally Delete Files with Find Command

How to discover files matching a find condition and delete them upon user confirmation.

To find all files with zero length and ask if they should be deleted:

find / -size 0 -ok rm {} \;

The backslash \ is important because it tells the shell to ignore the semicolon symbol which usually separates commands on a single command line.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

error: Content is protected !!