Shell script to find difference in folders in Linux Directories

by rajesh 2012-05-02 15:49:45

Here is a sample code to find the difference of folders between two directories in linux.

Example, consider that we have synched set of folder is /home and /backup, but old folders wont be deleted from backup when its deleted in home.

So find the folders that are in /backup and not in /home

for arg in $(ls /backup)
do
if [ ! -d /home/$arg ]
then
if [ -d /backup/$arg ]
then
echo "the folder $arg is not in /home "
fi
fi
done
1098
like
0
dislike
0
mail
flag

You must LOGIN to add comments