windowsfile-iobatch-rename

How do I rename files in sub directories?


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.


Solution

  • 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