I would need a script that can find files with the given extension on the given path, but excluding directories, their name taken from a file.
We have a script.sh and a white.list file. white.list contains:
/path/something
/path/someotherthing
Script has:
whitelistfile=/scriptdir/white.list
whitelist=`cat $whitelistfile`
if test -n "$whitelist"
then
# collect whitelist paths
for listitem in $whitelist;
do
excludepath+="! -path \"${listitem}*\" "
done
files=`find "$path" $excludepath -name *."$3" -type f`
fi
echo $files
The problem is that find does not accept $excludepath argument. Says there is no such directory.
Can someone help me with this, please?