Last active
November 5, 2017 12:12
-
-
Save M3ales/188abf79b4c0cc6b24fb9bf70dee3d27 to your computer and use it in GitHub Desktop.
Short script to automate file renaming for custom heroes duplicated off base heroes in Darkest Dungeon. Copy the heroes/<heroname> folder, rename it to what you want, and place this file inside it. Run it, specify the old name (original hero class name), and your new name and it'll go through all the filenames, atlases, and art.darkest/info.dark…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enabledelayedexpansion | |
:start | |
set /p "Pattern=Old Name:" | |
set /p "Replace=New Name:" | |
set /a num=0 | |
set /a total=0 | |
echo ------ | |
for /D %%# in (%~dp0%Pattern%_*) Do ( | |
echo Renaming %%# | |
Set "File=%%~nx#" | |
set /a num+=1 | |
ren "%%#" "!File:%Pattern%=%Replace%!" | |
) | |
echo Done. (%num% skin folders found) | |
set /a num=0 | |
echo ------ | |
echo Replacing %Pattern% with %Replace% in files... | |
for /R %%# in (*%Pattern%*) Do ( | |
echo Renaming %%~nx# | |
set "File=%%~nx#" | |
set /a num+=1 | |
ren "%%#" "!File:%Pattern%=%Replace%!" | |
) | |
echo "Done. (%num% files renamed)" | |
set /a num=0 | |
echo ------ | |
echo Updating Atlases... | |
for /R %%# in (*.atlas) Do ( | |
Set "File=%%~nx#" | |
echo Updating %%~nx# | |
@echo on | |
for /f "delims=" %%i in ('type "%%#" ^& break ^> "%%#" ') do ( | |
set /a num+=1 | |
set "line=%%i" | |
>>"%%#" echo !line:%Pattern%=%Replace%! | |
) | |
@echo off | |
) | |
echo Done. %num% lines checked. | |
set /a num=0 | |
echo ------ | |
echo Updating %Replace%.info.darkest... | |
Set "File=%Replace%.info.darkest" | |
@echo on | |
for /f "delims=" %%i in ('type "%File%" ^& break ^> "%File%" ') do ( | |
set /a num+=1 | |
set "line=%%i" | |
>>"%File%" echo !line:%Pattern%=%Replace%! | |
) | |
@echo off | |
echo Done. %num% lines checked. | |
set /a num=0 | |
echo ------ | |
echo Updating %Replace%.art.darkest... | |
Set "File=%Replace%.art.darkest" | |
@echo on | |
for /f "delims=" %%i in ('type "%File%" ^& break ^> "%File%" ') do ( | |
set /a num+=1 | |
set "line=%%i" | |
>>"%File%" echo !line:%Pattern%=%Replace%! | |
) | |
@echo off | |
echo Done. %num% lines checked. | |
echo ------ | |
echo ------ | |
echo Hero Rename Complete. | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment