Shell command (on Mac OSX El Capitan) to recursively rename all my DOCX files <p>I am trying to build a shell command (on Mac OSX El Capitan) to recursively rename all my DOCX files to have extension ZZZZ and then to immediately rename them back again to the DOCX extension. This is a workaround to hopefully fix a problem as follows:</p> <p>I am doing this to try to get around a Mac Spotlight bug which doesn't search for content inside Mac Word 2011 files correctly. It gives intermittent results and seem to miss a lot of hits (this issue seem to be well-known for a few years on Apple Mac Forums). Renaming a file seems to kick-start Spotlight into action.</p> <p>Mac Shell doesn't have the BASH Rename command so I am trying to iteratively use the "MV" command. I've had partial success with the following code but don't know how to tie it together...</p> <pre><code>cd ~/Documents/TESTING/ # FINDS MY DOCX'S RECURSIVELY IN TOP-LEVEL FOLDER AND IT'S SUBFOLDERS. NOT SURE OF SYNTAX TO USE FOR "MV" COMMAND TO RENAME DOCX FILES # find . -wholename '*.docx' -type f -exec mv UNSURE1HERE UNSURE2HERE \; # WORKS BUT ONLY IN TOP-LEVEL FOLDER - I NEED IT TO WORK RECURSIVELY ON DOCX'S IN TOP-LEVEL FOLDER AND IT'S SUBFOLDERS: # for files in *.docx; do mv "$files" "${files%.docx}.zzzz"; done </code></pre>