How do I rename files in sub directories?

Shoban picture Shoban · Oct 29, 2008 · Viewed 86.8k times · Source

Is there any way of batch renaming files in sub directories?

For example:

Rename *.html to *.htm in a folder which has directories and sub directories.

Answer

Anonymous picture Anonymous · Oct 29, 2008

Windows command prompt: (If inside a batch file, change %x to %%x)

for /r %x in (*.html) do ren "%x" *.htm

This also works for renaming the middle of the files

for /r %x in (website*.html) do ren "%x" site*.htm