Deleting all empty files with a single command?

Steve Holmes steve at holmesgrown.com
Tue Jun 4 08:54:41 EDT 2002


Hey, good comment.  I had no idea the find command was so powerful
myself.  In the past, I have used the find command to create a list
and pipe that into a script but this sounds more concise.

See, we learn something every day:).

On Tue, Jun 04, 2002 at 08:59:58AM +0300, Ari Moisio wrote:
> 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
> 
> 
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup




More information about the Speakup mailing list