Chinaunix首页 | 论坛 | 博客
  • 博客访问: 84633
  • 博文数量: 18
  • 博客积分: 1521
  • 博客等级: 上尉
  • 技术积分: 150
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-22 18:07
文章分类

全部博文(18)

文章存档

2014年(4)

2011年(1)

2010年(4)

2008年(9)

我的朋友

分类:

2008-10-05 07:56:29

比较不同目录下文件是否相同的脚本 #!/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
阅读(728) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~