I check if there's some files of a certain kind inside a folder to lowercase the extension and then extract the content this way:
existDoc=""$(ls | grep .DOC | wc -l)
if [ $existDoc -gt 0 ]; then
for file in *.DOC
do
mv $file $(basename "$file" .DOC)".doc"
done
fi
and then conversion
for word in *.doc
do
text_doc=""$(basename "$word" .doc)
sudo catdoc $word > $text_doc".txt"
done
The issue is that a new empty file is created named "*.doc.txt" with no apparent reason.