Deleting all empty files with a single command?

Ari Moisio armoi at sci.fi
Tue Jun 4 01:59:58 EDT 2002


Hi!

Octavian Rasnita 03.06.02:

>I want to delete all empty files from a directory with a single command.
>What switch should I use to "select" all the empty files?

  In command line you can write:
find . -maxdepth 1 -type f -size 0 -exec rm {} \;

  ...well: find is a command to find files for certain criteria. First
dot means start from current directory, -maxdepth 1 means not recursing
into subdirectories, -type f means only ordinary files, -size 0 is quite
obvious and -exec will launch rm to erase file if all previous
conditions are met. {} in exec is replaced by file name and \; means end
of -exec command.

  To see more options see find man page:-)

-- 
Mr. Ari Moisio, Niittykatu 5, 41160 Tikkakoski, +358-40-5055239
ari.moisio at iki.fi http://www.iki.fi/arimo PGP-keyID: 0x3FAF0F05





More information about the Speakup mailing list