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
Windows Presentation Foundation Designed by Microsoft Technologies, the Microsoft Technologies windows Display Groundwork (or WPF) is a computer-software graphic subsystem for maki

Have the user input two values. Store them in variables called savings and expenses, both of data type double. If expenses is less than savings, subtract expenses from savings, o

Develop a Windows Forms Application by creating a new project named "xxxxxxxx" in a new folder named "xxxxxxxxas3" where xxxxxxxx is your student id. You should delete file(s) with

write a program to sort the file sequential order and store on magnetic tape and print sorted tape as the output of the program.

You are to build a Schema in XML Schema Language that will be used to support the development of the new central course information management system and other supporting applicati

You are to write a program which will answer a pair of questions for squares, triangles, circles and ellipses. A square is defined by its lower left corner (SLLx,SLLy), and the len

PLEASE HELP ME ORACLE PROGRAMING TRIGGER

I have a linux lab class that consist of 1 lab assignment per week for 5 weeks. It is an online virtual lab and is fairly easy, I just don''t have the time.


Triple Eigenvalue with 1 Eigenvector The eigenvalue/vector pair in this case are l and  ?h , . Since the eigenvalue is real we know as the first solution we require is, e l