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
What are the main pros and cons of assembly programming language?

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

Question : (a) Many systems provide support for both user threads and kernel threads, resulting in different multithreading models. What are the two differences between user


interference of waves

Windows XP using C# load a binary file and send it thru a USB port to the USB port of STM32. STM32 received the file and then write it into an I2C EEPROM.

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

You will be working on creating both a realistic project environment and on adding new features to a simple shell implementation provided in shell.tar.z. After you un-tar it, let's

Problem Solving 1. Write Pascal code that accepts as input the names of the students, course work score and exam score for a unspecified number of students who have taken a subjec

1- If the order of a (mod P) is 3, prove that the order of a+1 is 6. 2- Explain why the "simplifiled knapsack" code is not secure.