Using Cygwin on Windows 10, I am trying to find files in one directory (dir1) that are not in another (dir2), regardless of the file path
The idea is to loop through all files in dir1 and, for each, launch a find command in dir2 and display only the missing files:
for f in `ls -R /path/to/dir1` ; do
if [ $( find /path/to/dir2 -name "$f" | wc -l ) == 0 ] ; then
echo $f
fi
done
The problem is that some of the file names have spaces in them and this is causing the find command to fail
Any ideas?