Add prefix to File name
About this command.
Summary
scss file に "_" が付いていない library があり、一括で rename する必要があったので作成.
Usage
- >addprefix [付加したい文字(一文字のみ)]
Code
- @echo off
- rem REVISION LOG ENTRY
- rem
- rem File name : addprefix.bat
- rem Revision By: (C) Copyright 2014 Hiroyuki Tominaga, All Rights Reserved.
- rem
- rem Revised on : 2014-06-25 19:56:27
- rem Summary : scss file に "_" が付いていない libirary があり、一括で rename する必要があったので作成.
-
-
- SETLOCAL EnableDelayedExpansion
-
- set PREFIX=%1
-
- if "%PREFIX%"=="" goto :HELP
-
- for /F "delims=" %%i in ('dir /b *') do (
- set B=%%i
- set B=!B:~0,1!
- if not !B!==%PREFIX% (
- echo has not prefix, do rename
- ren %%i %PREFIX%%%i
- )
- )
- goto :EOF
-
- ENDLOCAL
-
- :HELP
- echo. ---------------------------------------------------------------------------------------
- echo.
- echo addprefix [prefix string]
- echo.
- echo. ---------------------------------------------------------------------------------------