php - How do I batch-rename filenames in windows 7, so that they have numerical order at the end of them? -
i have archive of php files on computer, , want mass rename them. here's problem. here's sample of files (i have 420,000 of these).
viewtopic.php_id=4 viewtopic.php_id=5 viewtopic.php_id=6
i want these files in .php. now, know rename file extensions go cmd , cd file, go "ren *.* *.php"
.
however, can't this, because files named viewtopic
. love have renames files viewtopic1, viewtopic2, viewtopic3
, or hell 1,2,3,4,5,6,7, etc
, .php. after that, can batch rename files thru cmd.
if understand correctly, want rename viewtopic.php_id=x
viewtopicx
.php.
:: simple batch script @echo off setlocal enabledelayedexpansion :: assuming files exist in same directory tree. :: note - take while. 30 minutes or more ( guess ) :: - not going add check see if php_id files. :: if have other file types in subdirectory, :: effect them too, , results unpredictable. :: add check it, easier move *.php_id* own subdirectory /r %%i in ( * ) ( :: set extension after period set "extension=%%~nxi" :: remove not number set "num=!extension:php_id^==!" :: rename original file file name (%%~ni) + number + ".php" rename %%i %%~ni!num!.php ) endlocal @echo on
Comments
Post a Comment