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

Assignment Help:

 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..

 


Related Discussions:- Shell script to delete all files from system have size zero

Html code to create a web page design , 1.  Develop HTML code to create a W...

1.  Develop HTML code to create a Web page with the red background and title "My First Page" in any other color. 2.  Develop an HTML document with details of your name, telephon

Write script to clear the variables in the workspace, Write a script called...

Write a script called 'prob2.m' that asks the user if they wish to clear the variables in the workspace. If the user responds with the strings 'y' or 'yes' then the workspace shoul

Javascript variables and datatypes, Let us first see the skeleton of a Java...

Let us first see the skeleton of a JavaScript file. JavaScript code should be written between the and tags. The value LANGUAGE = "JavaScript" indicates to the browser that J

Explain the booch methodology, Problem 1 Explain the Booch Methodology ...

Problem 1 Explain the Booch Methodology 2 Why does every interaction diagram need a written description? Explain 3 Explain the five core workflows of the Unified Process

Write a perl program to design a computer game, Write a Perl program ghici....

Write a Perl program ghici.pl, one of the simplest computer games. The program should generate a random integer between 1 and 1000 and asks the user to guess it. If the user ?nds t

Visual basic.net, how to create a screen for messages for a data transmissi...

how to create a screen for messages for a data transmission system

Scramble word game, The aims of this assignment are to:    Provide e...

The aims of this assignment are to:    Provide experience in the use of a modern Integrated Development Environment (specifically NetBeans running on a Linux platform) for t

Retrive unicode text using vb.net ado.net, How Can I Retrive Unicode CSV Fi...

How Can I Retrive Unicode CSV File the ADO.net VB.net

Java reflection api, Expertsmind brings you unique solution in java assign...

Expertsmind brings you unique solution in java assignments Reflection API Uses of Reflection with java assignment help Reflection is widely used by applications which

Program to explore page replacement algorithms, Objective: The purpose of ...

Objective: The purpose of this programming project is to explore page replacement algorithms. This can be accomplished by developing a simple simulator that implements various pag

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd