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
Microsoft Intermediate Language in .NET When you create value in any terminology and gather, it will be changed to an 'Intermediate Language' (Microsoft Advanced Language - MSIL


Write out the Syntax of Nested if Statements? The universal form is                         If(expression 1)                         {

I need help with having a user input a year, and my program to spit out what day of the week Christmas is on.... any helping hands on this?

would you like to see some of my code. I am trying to do an add friend request. when I view my friends page I click on the add button. with ajax I want the script to send over the

code for using tree view control and fill it with database

What are program visible and invisible resisters? A4) Program visible is those registers that can be programmed by the users, or which are customizable, whereas Program invisible

This is the programming language of the Web. It is mainly used for validating forms. JavaScript & Java can be associated to each other. There exist several other differences betwee

3d Interpolation using matlab from x,y, and z coordinates in a csv file and reading them after that interpolating them..

Write a Program to illustrate the call by value? #include . int compute_sum(int m); int main( void) { int n=3, sum; printf("%d\n",n); /*3 is printed */ sum=compute_sum(n