westdc-zf1/tools/datafile-generate.sh

32 lines
646 B
Bash
Raw Normal View History

#!/bin/bash
data_dir=$1
if [ $# -ne 1 ]
then
echo "Usage: $0 {DATA_DIR}"
exit 1
fi
rm dataset.txt
cat_txt=$$
find $data_dir | grep uuid.txt > $cat_txt
cat $cat_txt | while read oneline;
do
echo $oneline >> dataset.txt;
cat "$oneline" >> dataset.txt;
uuid=`cat "$oneline"`;
if [ -e $uuid.txt ]
then
echo "do nothing! uuid重复"
else
find -L "${oneline%uuid.txt}" -exec du -b -s {} \; -exec ./dir_output.sh "{}" \; >$uuid.txt
echo $uuid
2011-03-04 11:40:59 +00:00
sed -i '/uuid.txt$/,/file$/d' $uuid.txt
fi
echo -e \\n >> dataset.txt;
done
# 删除空行
sed -i '/^$/d' dataset.txt
rm $cat_txt
sed -i 's/uuid.txt//' dataset.txt
sed -i 's/^ //' dataset.txt
exit 0