`
Fangrn
  • 浏览: 799114 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

AIX下比较两个目录文件并同步数据,供参考

阅读更多

#!/usr/bin/ksh
# Compare the two directory files and synchronize them
# Change the directory variables as your case

A_DIR=/A_DIR_PATH
B_DIR=/B_DIR_PATH
ls -l $A_DIR|awk '{print $9,$5}'>/tmp/A_list.log
ls -l $B_DIR|awk '{print $9,$5}'>/tmp/B_list.log
diff /tmp/A_list.log  /tmp/B_list.log |awk '$1=="<" {print $2}' >/tmp/check.log
while read LINE
do
cp -r $A_DIR/$LINE $B_DIR
done < /tmp/check.log

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics