Skip to content

Instantly share code, notes, and snippets.

View andrewyager's full-sized avatar

Andrew Yager andrewyager

View GitHub Profile
@andrewyager
andrewyager / Batch File Rename.scpt
Last active July 14, 2016 07:19 — forked from oliveratgithub/Batch File Rename.scpt
Simple AppleScript to easily batch rename multiple files sequentially for use with an PRG MBox. GUI asks user to select files and will preserve the name and extension. It as forked from another script that gave us most of the scaffolding.
-- This code comes from https://gist.github.com/oliveratgithub/
-- Open in AppleScript Editor and save as Application
-- ------------------------------------------------------------
--this is required to break the filename into pieces (separate name and extension)
set text item delimiters to "."
tell application "Finder"
set all_files to every item of (choose file with prompt "Choose the Files you'd like to rename:" with multiple selections allowed) as list
--now we start looping through all selected files. 'index' is our counter that we initially set to 1 and then count up with every file.
--the 'index' number is of course required for the sequential renaming of our files!
repeat with index from 1 to the count of all_files