Google

比较不同目录下文件是否相同的脚本

2007-11-29 23:22 来源: qiaoby.cublog.cn 作者:qiaoby 网友评论 0 条 浏览次数 98
 
#!/bin/bash
path1="/home/test1"
path2="/home/test2"
for file in $(find $path1 -type f -name '[^\.]*')
do
file=${file##*/}
for file1 in $(find $path2 -type f -name '[^\.]*')
do
file1=${file1##*/}
echo "-------------------------"
n=0
if [ "$file" == "$file1" ]
then
        echo "$path1/$file is identical with $path2/$file1"
        let 'n+=1'
        echo "Total $n files are identical"
fi
done
done
上一篇: 下一篇:

相关主题:目录  脚本  文件  比较

网友评论