Add artist to filename with AutoHotkey
A common task I’ve been using AutoHotkey for lately is adding the artist to the filename of an mp3. Here’s some quick code to do that:
RenameSongs(path, artist)
{
	Loop %path%\*.mp3
	{
		IfNotInString A_LoopFileName, %artist%
		{
			newfilename = %artist% - %A_LoopFileName%
			StringReplace newfilename, newfilename, (1),, All
			FileMove %path%\%A_LoopFileName%, %path%\%newfilename%
		}
	}
	TrayTip File rename,Done!
}
Then call it from somewhere else with a path and a proper artist name. How you do that part is up to you, I’m just plugging the values into the script. You could probably make an explorer keyboard shortcut and a box that prompts you for the artist name if you so desired.
2 Comments