2011-03-04 11:17:49 +00:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
data_dir=$1
|
2011-03-04 11:30:15 +00:00
|
|
|
|
if [ $# -ne 1 ]
|
2011-03-04 11:17:49 +00:00
|
|
|
|
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"`;
|
2012-06-28 09:11:02 +00:00
|
|
|
|
# 移除前后空格,避免错误
|
|
|
|
|
uuid=`echo $uuid`;
|
2011-03-04 11:17:49 +00:00
|
|
|
|
if [ -e $uuid.txt ]
|
|
|
|
|
then
|
2012-06-25 14:03:31 +00:00
|
|
|
|
echo "do nothing! uuid重复或后面有空格:$uuid"
|
2011-03-04 11:17:49 +00:00
|
|
|
|
else
|
2011-03-04 11:30:15 +00:00
|
|
|
|
find -L "${oneline%uuid.txt}" -exec du -b -s {} \; -exec ./dir_output.sh "{}" \; >$uuid.txt
|
2011-03-04 11:17:49 +00:00
|
|
|
|
echo $uuid
|
2011-03-04 11:40:59 +00:00
|
|
|
|
sed -i '/uuid.txt$/,/file$/d' $uuid.txt
|
2011-03-04 11:17:49 +00:00
|
|
|
|
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
|