From 611582f02d6e0f77c3ef9b4e5594c8501046533e Mon Sep 17 00:00:00 2001 From: wlx Date: Fri, 4 Mar 2011 11:17:49 +0000 Subject: [PATCH] =?UTF-8?q?=E7=94=9F=E6=88=90=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E7=9B=B8=E5=85=B3=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/datafile-generate.sh | 40 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 tools/datafile-generate.sh diff --git a/tools/datafile-generate.sh b/tools/datafile-generate.sh new file mode 100755 index 00000000..6cc99f87 --- /dev/null +++ b/tools/datafile-generate.sh @@ -0,0 +1,40 @@ +#!/bin/bash +data_dir=$1 +if [ $# -ne 2 ] +then + echo "Usage: $0 {DATA_DIR}" + exit 1 +fi +dir_output +{ + if test -d "$1" + then + echo "directory" + else + echo "file" + 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 "{}" \; >$uuid.txt +echo $uuid +sed -i '/uuid.txt$/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