生成数据的文件路径相关信息的脚本
This commit is contained in:
parent
266325d796
commit
611582f02d
|
@ -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
|
Loading…
Reference in New Issue