#! /usr/bin/bash -
#################################################################################################################
# file_name: remove_hijack
# Author : Vincent.chen
# Date : 2009-03-31
# Platform : Cygwin Platform
# Usage : step 1: First, compile the project and then update the view.
# step 2: Second, undo hijack files and then make hijack file have
# (xxx.keep) of it's counterpart
# step 3: run this script
#################################################################################################################
# recurse find the file suffix with tag .keep and delete it from clearcase
do_recursive()
{
cd $1
for filename in `ls`
do
if [ -d "$filename" ]; then
do_recursive "$filename"
cd ..
else
prename=${filename%.keep}
if [ "$prename" != "$filename" ]; then
echo "`pwd`/$filename ===> $prename"
rm -f "$prename"
# cleartool rmelem -nc -f "$prename"
count=`expr ${count} + 1`
fi
fi
done
return 0
}
delete_hijack()
{
PARAMS=1
if [ $# -ne $PARAMS ]
then
echo "usage: remove_hijack your_dir_name"
return 1
fi
count=0
if [ -d "$1" ]
then
cd "$1"
else
echo "$1 is not a directory!!"
return 0
fi
do_recursive "$1"
echo "complete! $count hijack files have been deleted."
return 0
}
delete_hijack "$@"
阅读(1228) | 评论(0) | 转发(0) |