#!/bin/sh
#
# remove old so-lib at make submit
#
# @auth zhoulin@lianchuang.com
#
#
# Usage:
# keep_single_dir /ngboss/tuxapp/lculib /ngboss/tuxapp/lculib_old
#
keep_sosingle() {
LCULIBDIR=$1
LCULIBDIR_OLD=$2
find $LCULIBDIR -type f -name "lib*" | awk -F\- '{print $1}' | sort | uniq |\
while read prefix_so; do
idx=1
ls $prefix_so* | sort -r | \
while read file; do
if [ $idx -ne 1 ]; then
echo "moving " $file " from " $LCULIBDIR " to " $LCULIBDIR_OLD
mv $file $LCULIBDIR_OLD
fi
let idx=idx+1
done
done
}
keep_sosingle $1 $2