#!/bin/bash
pa=$1
dirindexfile=$pa/.dirindex

rm $dirindexfile
echo "version:1" >> $dirindexfile
echo "path:/${pa#*/Terrain}" >> $dirindexfile 

for file2 in `ls -a $pa`

do
    if [ x"$file2" != x"." -a x"$file2" != x".." -a x"$file2" != x".dirhash" -a x"$file2" != x".dirindex" -a x"$file2" != x".zj" ];then
       pc=$pa/$file2/.dirindex
       echo d:$file2:`sha1sum $pc | awk '{print $1}'` >> $dirindexfile
#       echo $pc
    fi
done
