ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/removeZeroLengthFiles.sh
Revision: 1.4
Committed: Tue Feb 28 11:54:36 2012 UTC (13 years, 2 months ago) by paus
Content type: application/x-sh
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, HEAD
Changes since 1.3: +10 -2 lines
Log Message:
Last updates.

File Contents

# User Rev Content
1 paus 1.1 #!/bin/bash
2    
3     DIR=$1
4 paus 1.4 if [ "$2" != "" ]
5     then
6     PATTERN=$2
7     else
8     PATTERN=root
9     fi
10 paus 1.1
11     # Health checks
12     if [ ".$1" == "." ]
13     then
14     echo "";
15 paus 1.4 echo "usage: $0 <directory-list> [ <pattern> = root ] ";
16 paus 1.1 echo ""
17     exit 1
18     fi
19    
20 paus 1.4 list $DIR | grep $PATTERN | \
21 paus 1.1 while read line
22     do
23 paus 1.4
24 paus 1.2 size=`echo $line | tr -s ' ' | cut -d ' ' -f 1`
25     file=`echo $line | tr -s ' ' | cut -d ' ' -f 2`
26 paus 1.1 if [ "$size" == "0" ]
27     then
28     echo "File: delete $file with $size bytes"
29 paus 1.2 remove --exe $DIR/$file
30 paus 1.1 fi
31 paus 1.4
32 paus 1.1 done