I do have a very special problem (to me) when using find.
What I want to do is to search one directory and for every file found to check if it is existing in another directory. The Problem is that the directory where to search for the files has very long paths included.
Example:
Directory to search in: /tmp/tmp.6ueJftvZHZ/working_tree
Longest path: /tmp/tmp.6ueJftvZHZ/working_tree/usr/share/applications-desktop-files/applications
To find the files I do use this code:
Code: Select all
Path="/tmp/tmp.6ueJftvZHZ/working_tree"
plen="`echo ${#Path}`"
rm /root/files.txt
Files=`find $Path -maxdepth 8 -type f`
echo "$Files" |while read F
do
echo "$F" >> /root/files.txt
if [ "$F" != "" ]; then
if [ "$F" != "$Path/" ]; then
nlen="`echo ${#F}`"
findname=${F:plen:nlen-plen}
if [ -f $findname ]; then
echo $F
#rm $F
fi
fi
fi
done
The paths are too long, aren't they?
How can I get searching through all directories?
Thanks
RSH