ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/removeZeroLengthFiles.sh
Revision: 1.3.2.1
Committed: Fri Jun 14 19:34:39 2013 UTC (11 years, 10 months ago) by paus
Content type: application/x-sh
Branch: Mit_025c_branch
CVS Tags: Mit_025c_branch2
Changes since 1.3: +10 -2 lines
Log Message:
PrepareForBackportVersion3.

File Contents

# User Rev Content
1 paus 1.1 #!/bin/bash
2    
3     DIR=$1
4 paus 1.3.2.1 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.3.2.1 echo "usage: $0 <directory-list> [ <pattern> = root ] ";
16 paus 1.1 echo ""
17     exit 1
18     fi
19    
20 paus 1.3.2.1 list $DIR | grep $PATTERN | \
21 paus 1.1 while read line
22     do
23 paus 1.3.2.1
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.3.2.1
32 paus 1.1 done