How to rename multiple files in multiple folders with one command
get-childItem -recurse | Where {$_.extension -eq ".html"} | rename-item -newname { $_.name -replace ".html",".php" }
This will work in PowerShell. If you have Windows 7 or Vista, you should have it installed by default. If you are on XP you can download it here.
In command line:
for /f "delims=*" %a in ('dir *.html /b /s') do ren "%a" *.php
Note: You can replace *.html
for other wildcard, e.g. d:\www\*.html
.
Note 2: If using the command within a batch file, replace %a
with %%a
(don't ask me why)
Using forfiles, we can write a script, to rename files recursively in all subfolders.
forfiles /S /M *.html /C "cmd /c rename @file @fname.php"
Source: Batch script for renaming files in bulk