35% OFF + 2x Orange Slices using the discount code: OrangeFriday2022

Here's a cool trick for Windows users that will save you from buying batch file renaming software (or spending hours trying to find good freeware batch renamers). Not to mention most batch renamers are very basic and do not allow duplicate rules for renaming--for example searching for text and renaming the filename accordingly. This method of batch file renaming uses the .bat file format, which can be created in Notepad.



Here are the steps to creating a batch renamer:

1. Open Notepad

2. Use the following code to identify text and rename the file.

@echo off
SetLocal EnableDelayedExpansion

for %%f in ("*D2*") do (
set name=%%f
set str=!name:~0,2!
if not !str!==01 ren "%%f" "01-%%f"
)

3. Right now this code takes all filenames containing the text, "D2", and adds "01-" at the beginning of the name. Add as many of these renaming rules as you wish, repeating the last paragraph of code as needed (the text in bold is what you need to edit).

4. Save as a .bat file and run it! Be warned, you cannot undo the changes the .bat file makes, so keep a backup the files being operated on!

This renaming system is really useful for renaming samples from traditional note-name-based filenames to number-based ones which will sort alphabetically correctly (making them much easier to map in Kontakt or other sampler).

It's a bit of manual work setting up the .bat file with each note, but once you make the .bat file, you can reuse it as many times as you like.

@echo off
SetLocal EnableDelayedExpansion

for %%f in ("* D2 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==01 ren "%%f" "01-%%f"
)

for %%f in ("* D#2 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==02 ren "%%f" "02-%%f"
)

for %%f in ("* E2 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==03 ren "%%f" "03-%%f"
)

for %%f in ("* F2 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==04 ren "%%f" "04-%%f"
)

for %%f in ("* F#2 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==05 ren "%%f" "05-%%f"
)

for %%f in ("* G2 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==06 ren "%%f" "06-%%f"
)

for %%f in ("* G#2 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==07 ren "%%f" "07-%%f"
)

for %%f in ("* A3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==08 ren "%%f" "08-%%f"
)

for %%f in ("* A#3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==09 ren "%%f" "09-%%f"
)

for %%f in ("* B3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==10 ren "%%f" "10-%%f"
)

for %%f in ("* C3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==11 ren "%%f" "11-%%f"
)

for %%f in ("* C#3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==12 ren "%%f" "12-%%f"
)

for %%f in ("* D3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==13 ren "%%f" "13-%%f"
)

for %%f in ("* D#3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==14 ren "%%f" "14-%%f"
)

for %%f in ("* E3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==15 ren "%%f" "15-%%f"
)

for %%f in ("* F3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==16 ren "%%f" "16-%%f"
)

for %%f in ("* F#3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==17 ren "%%f" "17-%%f"
)

for %%f in ("* G3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==18 ren "%%f" "18-%%f"
)

for %%f in ("* G#3 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==19 ren "%%f" "19-%%f"
)

for %%f in ("* A4 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==20 ren "%%f" "20-%%f"
)

for %%f in ("* A#4 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==21 ren "%%f" "21-%%f"
)

for %%f in ("* B4 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==22 ren "%%f" "22-%%f"
)

for %%f in ("* C4 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==23 ren "%%f" "23-%%f"
)

for %%f in ("* C#4 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==24 ren "%%f" "24-%%f"
)

for %%f in ("* D4 *") do (
set name=%%f
set str=!name:~0,2!
if not !str!==25 ren "%%f" "25-%%f"
)


Enjoyed reading this blog article? Check out the other articles in this topic: DIY Sampling


Share with Your Friends