Find missing filenames from a list recursively
by qombi from LinuxQuestions.org on (#4WSZM)
Hello,
I have researched how to find missing filenames from a list recursively and I am close but not there completely.
I have files on one server that I need to verify exist on another server. I first made a list of the files with Code:ls > filelist on one server. Copied that list to the other server for auditing.
I then executed script on server to be audited:
Code:while IFS= read -r name; do
[ -n "$(find / -name "$name" -print | head -n 1)" ] || printf '%s\n' "$name"
done < filelistThis printed out a list of missing files to the screen which was partially correct. The issue is files with special characters and spaces in their names. They show as missing. If I manually change files such as Code:[this] file name to Code:\[this\]\ file\ name, then it works properly. I tried Code:' ' or Code:" " but that didn't seem to work.
How do I print a list of filenames from the originating server that contain the backslashes in files for special characters and spaces? I found Code:ls -b but that only shows Code:\ for the spaces not special characters.
Or is there a better way of doing this all together? Thanks


I have researched how to find missing filenames from a list recursively and I am close but not there completely.
I have files on one server that I need to verify exist on another server. I first made a list of the files with Code:ls > filelist on one server. Copied that list to the other server for auditing.
I then executed script on server to be audited:
Code:while IFS= read -r name; do
[ -n "$(find / -name "$name" -print | head -n 1)" ] || printf '%s\n' "$name"
done < filelistThis printed out a list of missing files to the screen which was partially correct. The issue is files with special characters and spaces in their names. They show as missing. If I manually change files such as Code:[this] file name to Code:\[this\]\ file\ name, then it works properly. I tried Code:' ' or Code:" " but that didn't seem to work.
How do I print a list of filenames from the originating server that contain the backslashes in files for special characters and spaces? I found Code:ls -b but that only shows Code:\ for the spaces not special characters.
Or is there a better way of doing this all together? Thanks