If you want code rather than a suggestion for fixing the issue, which is that the unexpected filename in question may have trailing space or other non-printing characters embedded in it, here you go. This implements what I understand from your question, which is to delete files and directories that are older than a day:
#!/bin/bash
base='/volume1/Ingest'
days=1
# Find directories not modified for a day
readarray -d '' -t dirs < <(find "$base" -depth -type d -mtime +"${days:-1}" -print0)
# Check files in each directory
for dir in "${dirs[@]}"
do
printf 'DIRECTORY %s\n' "$dir"
find -- "$dir" -maxdepth 1 ! -type d ! -name '*.txt' -mtime +1 -printf 'DELETE %P\n' ## -delete
if [ "$(find -- "$dir" -maxdepth 1 -printf '.' 2>/dev/null | wc -c)" -gt 1 ]
then
printf 'DELETE DIRECTORY %s\n' "$dir"
## rmdir -- "$dir"
fi
echo
done
This code will avoid *.txt files in every directory, per your question. You can remove or comment the printf statements in the Check files… loop if you want the process to be silent. Uncomment the two ## elements to delete your files and directories; otherwise it's just a reporting tool
.txt? Can you pipe the output toLC_ALL=C sed -n l(that's lowercaseL). Also try with!instead of that non-standard-not.!, you mostly have to prevent the shell from expanding it, e.g. by prefixing it with a backslash so-notbecomes\!.findflavor you have.!on its own is a problem.find's!has been used fine for about 50 years.