比较不同目录下文件是否相同的脚本
#!/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
阅读(764) | 评论(0) | 转发(0) |