I need to change multiple files names based on their name.
I have files named like this.
001.mp3
002.mp3
003.mp3
004.mp3
005.mp3
...etc
I made some code to achieve my aim like this:
@echo off
for %%i in (*.mp3) do if %%~ni gtr 003 ren %%i %%~ni-new%%~xi
I have gotten successfully desired result like this:
001.mp3
002.mp3
003.mp3
004-new.mp3
005-new.mp3
...etc
But now I am trying something different like 'if
between'.
For example:
@echo off
for %%i in (*.mp3) do
if %%~ni between 001 && 003 ren %%i %%~ni-chapter-1%%~xi
if %%~ni between 004 && 006 ren %%i %%~ni-chapter-2%%~xi
if %%~ni between 007 && 020 ren %%i %%~ni-chapter-3%%~xi
if %%~ni between 021 && 030 ren %%i %%~ni-chapter-4%%~xi
if %%~ni between 031 && 045 ren %%i %%~ni-chapter-5%%~xi
so the desired result will be like this:
001-chapter-1.mp3
002-chapter-1.mp3
003-chapter-1.mp3
004-chapter-2.mp3
005-chapter-2.mp3
006-chapter-2.mp3
007-chapter-3.mp3
008-chapter-3.mp3
009-chapter-3.mp3
010-chapter-3.mp3
...etc
Please, help me to fix this code as demonstrated.
See Question&Answers more detail:os