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

Document type definition schema, Create a DTD which describes the structure...

Create a DTD which describes the structure of the document which you prepared in Question 1. Make sure that you use all appropriate DTD ingredients to constrain valid documents as

Provide example of function, Provide Example of Function? An illustrati...

Provide Example of Function? An illustration of a function definition main() { message(); } /* header */ message() { /*bodystarts here*/ printf ("Example for function

Matlab, need some one to help me with malab

need some one to help me with malab

Cookies management with perl, One of the main strengths of the Perl program...

One of the main strengths of the Perl programming language are its powerful text manipulation features. In this assignment, you will put them to use for writing a Perl program tha

Develop a windows forms application, Develop a Windows Forms Application by...

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

Create c sharp classes needed to track creature viability, P4's goal is to ...

P4's goal is to design the C# classes needed to track creature viability in a MMO game under development .  Part I: Class design 1)  GameCreature class (with derived ty

Differentiate between high level and low level languages, The languages use...

The languages used in the module are of a type known as high-level languages. There is another set of languages known as low-level languages. (a) Differentiate between high-leve

Improved application deployment, Improved Application Deployment Data sourc...

Improved Application Deployment Data source implementation is perhaps the key to any Asp.net program implementation, and, if the database implementation is easily done, there is an

ARM LANGUAGE, I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

I WANT TO MAKE PROJECT IN ARM LANGUAGE CAN YOU HELP ME

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