find /Users/wjst/Desktop -type f -name "*.odt"> /tmp/out SAVEIFS=$IFS; IFS=$(echo -en "\n\b"); while read line ; do cd $(dirname $line); /Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to docx $(basename $line); echo $PWD; cd -; done < /tmp/out; IFS=$SAVEIFS
modified after http://askubuntu.com/questions