Echo Missing Files From Partition

Discussion in 'Programming/Scripts' started by overkill, Oct 9, 2009.

  1. overkill

    overkill New Member

    I'm trying to clean up my samba share and need to echo out the files which are missing from the directory recursively. If it finds the file from the list it simply echo's the path. If it doesn't find it from the path then it echo's out the missing file. So far I have this but can't seem to get the logic right. Can anyone help point me in the right direction?

    for FILE in `cat list`; do

    if [ ! -z `find /opt -name $FILE` ];
    then
    echo "File $FILE does not exists"
    else
    echo "$FILE exists"
    fi

    done
     

Share This Page