Deleting all empty files with a single command?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]
  Powered by Linux