or go by modified date, checksum or bit for bit compare of every file. Do you need to trim excess files in /appabc2/ ? New files need to be added, of course. Can there be new dirs? See man cpio pass option with updates only, which does a lot of this. The rsync command seems overkill for local files. Off the cuff = untested, files only, exact compare:
(
cd /appabc1
find . -type f
cd /appabc2
find . -type f
) | sort -u | while read f
do
f="${f#./}"
if [ ! -f "/appacb1/$f" ]
then
rm -f "/appabc2/$f" # prune
continue
fi
if [ -f /appabc2 -a "$(cmp "/appacb1/$f" "/appabc2/$f" 2>&1)" = "" ]
then
continue
fi
cp -p "/appacb1/$f" "/appabc2/$f"
done
It's good command , but I want accurate answer about this command
[LEFT]If I have file in the /dir1 called appfile.log has size :20MB[/LEFT]
[LEFT]And in /dir2 appfile.log has size :15MB[/LEFT]
[LEFT]If i re sync the directories by the below command