Shell script to delete all files from system have size zero, Programming Languages

 W.A.S.S to delete all such files from the system that have size zero.

 

Program

 

# W.A.S.S to delete all such files from the system that have size zero.

 

total=`ls -lSr | tr -s " "|cut -d " " -f5,9|wc -l`

total=`expr $total - 1`

for w in `ls -lSr | tr -s " "|cut -d " " -f5,9|tail -n$total|head -n1`

do

size=`ls -lSr | tr -s " "|cut -d " " -f5|tail -n$total|head -n1`

name=`ls -lSr | tr -s " "|cut -d " " -f9|tail -n$total|head -n1`

echo "$size  $name"

if test $size = "0"

then

 rm "$name"

echo "$name is deleted.."

else

 exit

fi

total=`expr $total - 1`

done

 

Output

 

sh zsize.sh

 

0  zero.sh

zero.sh is deleted..

0  mbox

             mbox is deleted..

 

Posted Date: 9/26/2012 8:02:15 AM | Location : United States







Related Discussions:- Shell script to delete all files from system have size zero, Assignment Help, Ask Question on Shell script to delete all files from system have size zero, Get Answer, Expert's Help, Shell script to delete all files from system have size zero Discussions

Write discussion on Shell script to delete all files from system have size zero
Your posts are moderated
Related Questions
#quFollow the my shell programming guidelines as in the other assignments. Write a shell script to send a customized mail message to the users listed on the command line by login (

In the form of hypermedia documents, Web pages or materials accessed by the Internet can be located anywhere in the world. Regardless of where they originated, most of the Web d

Write a procedure named Str_concat that concatenates a source string to the end of a target string. Sufficient space must exist in the target string to accommodate the new characte

Support for Multi-Targeting The multi-targeting function of Vision Facilities allows you specify the particular edition or account of the .NET Structure that is required for your p

Design and implement a stringed musical instrument class using the following guidelines: a. Data fields for your instrument should include number of strings, an array of stri


Simpson's Rule is a more accurate method of numerical integration than the method described in class. Using Simpson's Rule, the integral of a function f between a and b is approxim


Explain the While Statement - Computer Programming? A 'while statement' is an entry controlled loop statement. When the expression is calculated and the condition is not satisf

Determine the address accessed by each of the following instruction if DS=1100H, BX=0200H, LIST=0250H AND SI=0500H-: 1) MOV LIST[SI],EDX?0250+0500+11000=11750 2