#!/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
AIX下比较两个目录文件并同步数据,供参考
最新推荐文章于 2020-01-21 15:27:10 发布