Convert a folder of LibreOffice .ODT files to .DOCX files

I don’t spend much time in traditional “word processors”, but when I do, it is usually in LibreOffice. Then I prefer to save the files in the native .ODT format. But it happens that I need to send a bunch of files to someone that prefers .DOCX files. Instead of manually converting all the files, here is a short one-liner that does the trick using the magical pandoc, the go-to tool for converting text documents.

for i in *.odt; do name=`echo $i | cut -d'.' -f1`; pandoc "$i" -o "${name}.docx"; done

Paste it into a terminal window opened in the directory of choice and watch the magic!