Freitag, 10. Oktober 2014

remove zero sized file

To delete zero sized files in bash you can simply use an if clause with you can put in a loop. First the if clause

  if [ ! -s file ] ; then
    rm file
 fi

and finally the full loop:

 for file in *
 do
   if [ ! -s $file ] ; then
     rm $file
   fi
 done

Keine Kommentare:

Kommentar veröffentlichen