AppleScript to Rename file list to Specific Names

applescriptapplicationsautomationautomatorrename

I've spent hours researching this and I can't seem to find an answer, so your help would be greatly appreciated!

I have an audio recorder that outputs 16 files that are always named the same.

ORIGINAL FILE NAMES

(TRK01.WAV, TRK02.WAV, TRK03.WAV, TRK04.WAV, TRK05.WAV, TRK06.WAV, TRK07.WAV, TRK08.WAV, TRK09.WAV, TRK10.WAV, TRK11.WAV, TRK12.WAV, TRK13.WAV, TRK14.WAV, TRK15.WAV, TRK16.WAV)

I want an Automator App that changes the file names to the following list.

NEW FILE NAMES

(01_Lav.WAV, 02_HH1.WAV, 03_Piano.WAV, 04_TR AC.WAV, 05_MX AC.WAV, 06_Bass.WAV, 07_ElectG.WAV, 08_KickD.WAV, 09_Vox1.WAV, 10_Vox2.WAV, 11_Vox3.WAV, 12_Vox4.WAV, 13_CrowdL.WAV, 14_CrowdR.WAV, 15_Aux7_R.WAV, 16_MainLR_R.WAV)

This way I can save the Application on a hard drive where I transfer the files to and run it when needed.

I was thinking it would go something like this:

set theFolder to choose folder

set name of file “TRK01.WAV“ to “01_Lav.WAV“
set name of file “TRK02.WAV“ to “02_HH1.WAV“
set name of file “TRK03.WAV“ to “03_Piano.WAV“
set name of file “TRK04.WAV“ to “04_TR AC.WAV“
set name of file “TRK05.WAV“ to “05_MX AC.WAV“
set name of file “TRK06.WAV“ to “06_Bass.WAV“
set name of file “TRK07.WAV“ to “07_ElectG.WAV“
set name of file “TRK08.WAV“ to “08_KickD.WAV“
set name of file “TRK09.WAV“ to “09_Vox1.WAV“
set name of file “TRK10.WAV“ to “10_Vox2.WAV“
set name of file “TRK11.WAV“ to “11_Vox3.WAV“
set name of file “TRK12.WAV“ to “12_Vox4.WAV“
set name of file “TRK13.WAV“ to “13_CrowdL.WAV“
set name of file “TRK14.WAV“ to “14_CrowdR.WAV“
set name of file “TRK15.WAV“ to “15_Aux7_R.WAV“
set name of file “TRK16.WAV“ to “16_MainLR_R.WAV“

tell application "Finder"
    (open theFolder) select
end tell

How would this actually be done?

Best Answer

– user3439894, Thanks for the Help! This got me really close!

For anyone who needs to do the same thing, here's what I did to make it work. In my circumstance, I needed an application, so I can save it on a hard drive and use it on whatever Mac I'm working on at the time. I didn't need another service to clutter up my menus.

Here's how it's done:

1) Using Automator, create a "new document" type: "Application"

2) Insert "Ask for Finder Items" box and select Type: "Folders".

3) Insert "Get Selected Finder Items" box (below "Ask for Finder Items" box)

4) Insert "Run Shell Script" box. Set Shell: "/bin/bash" set Pass input: "as arguments".

5) Type:

cd "$1" || exit 1

mv TRK01.WAV 01_Lav.WAV 
mv TRK02.WAV 02_HH1.WAV 
mv TRK03.WAV 03_Piano.WAV 
mv TRK04.WAV "04_TR AC.WAV" 
mv TRK05.WAV "05_MX AC.WAV" 
mv TRK06.WAV 06_Bass.WAV
mv TRK07.WAV 07_ElectG.WAV
mv TRK08.WAV 08_KickD.WAV
mv TRK09.WAV 09_Vox1.WAV
mv TRK10.WAV 10_Vox2.WAV
mv TRK11.WAV 11_Vox3.WAV
mv TRK12.WAV 12_Vox4.WAV
mv TRK13.WAV 13_CrowdL.WAV
mv TRK14.WAV 14_CrowdR.WAV
mv TRK15.WAV 15_Aux7_R.WAV
mv TRK16.WAV 16_MainLR_R.WAV

Save the Application to desired location and you're done!