'파일명변경'에 해당되는 글 1건

  1. 2021.04.01 특정 패턴의 이름 규칙으로 파일명 변경 배치파일
Study/Tip & Tech2021. 4. 1. 10:56

빌드 파일을 배포전에 특정 패턴의 이름 규칙으로 변경 후 배포하기 위해 후처리 스크립트 적용

물론 빌드 할때 알아서 원하는 이름으로 빌드하는게 좋지만, 직접 바꾸고 싶다면

아래 글을 참고하여 완성된 변경, 롤백 배치 파일 활용

FileRenameByPattern.bat
@echo off
Setlocal enabledelayedexpansion

Set "Pattern=KakaoGames"
Set "Replace=NcSoft"

For %%# in ("*.apk") Do (
    Set "File=%%~nx#"
    Ren "%%#" "!File:%Pattern%=%Replace%!"
)
FileRenameByPattern-rollback.bat
@echo off
Setlocal enabledelayedexpansion

Set "Pattern=NcSoft"
Set "Replace=KakaoGames"

For %%# in ("*.apk") Do (
    Set "File=%%~nx#"
    Ren "%%#" "!File:%Pattern%=%Replace%!"
)

 

How to rename file by replacing substring using batch in Windows

stackoverflow.com/questions/16128869/how-to-rename-file-by-replacing-substring-using-batch-in-windows/16128973

Posted by 굥쓰