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.
set -x
to see what is going on. – michas Jul 29 '16 at 15:07rename "s/.DOC$/.doc/" *
. Userename -n "s/.DOC$/.doc/" *
to check the result before. – Marco Jul 29 '16 at 16:01mv "$file" "${file,,}"
– Jeff Schaller Jul 29 '16 at 16:44