If you need to chunk your audio into separate files and name them according to a specific naming convention that your client has provided, you've probably fiddled with renaming files, one at a time.
For a big project with a large number of files, this can be quite a bit of work.
Sure, you can find a nearly infinite selection of utilities online that will rename files for you. Many have fancy bells and whistles that go along with the task. However, if you simply need to add a suffix to all files meeting some naming or extension or path criteria, the old-fashioned way is the quickest and easiest.
The best part is that your computer - whether Windows, Mac or Linux - already has the stuff to do it, built right in.
Well, that's not quite correct: the best part is that you'll learn a nifty trick doing it this way, and you'll get to wield a little more power than is afforded by your mouse.
The first and probably most popular solution is to find a file renaming thingy online, download it and use it to perform the task.
The second option is to use the tools that already exist on the computer to do it.
I figure, teach a man to rename, and he will
s/eat lunch/save files/g
Say you have a bunch of files in a directory. You open a command prompt by hitting the Windows key and the letter 'R' at the same time, then type cmd in the dialog that pops up and click OK. In the command prompt window, you cd to your directory and ask for a listing, getting a result that looks something like this:
C:\Users\me>cd \Audio\Recording C:\Audio\Recording> dir /b FirstSoundFile.mp3 SecondSoundFile.mp3 ThirdSoundFile.mp3 FourthSoundFile.mp3 FifthSoundFile.mp3
Great! The files are all there! But you need to add a suffix onto each one, after the main part of the filename, but before the extension. Following our real-world example, that suffix is to be _QRZ.
How many commands do you think are needed to get it done? How many lines would you guess you'd have to type in?
One. Yep, just one. It's what we call a one-liner. It looks like this:
for /f "tokens=1* delims=." %F in ('dir /b *.mp3') do rename "%F.mp3" "%F_QRZ.mp3"
So you type that in, hit Enter and away it goes. How fast is it? Well, even for a big clump of files on a run-of-the-mill computer, it'll probably be done before you get your finger far off the Enter key.
C:\Audio\Recording> dir /b FirstSoundFile_QRZ.mp3 SecondSoundFile_QRZ.mp3 ThirdSoundFile_QRZ.mp3 FourthSoundFile_QRZ.mp3 FifthSoundFile_QRZ.mp3
Open your terminal, cd to your directory, and say:
rename .mp3 _QRZ.mp3 *.mp3
Instead of pasting the command in a text file and pasting it into a command prompt each time you need to use it, you can turn it into a self-contained little thingy that will run when you double-click its icon. If you've never written a program before, it's okay if you want to think of this as your first little program written by you!
A few minor edits will make our renaming command work in what's called a batch file. Batch files are simply text files that have a bunch ("batch") of commands that are executed in order from top to bottom, one line at a time. This is a bit of a simplification - you can do some branching and other fun stuff, for example - but that's not important right now.
Along with the edits to make it batch-file friendly, it would be really keen if you could specify the target directory, file extension and suffix text each time you run it. That way, you can put the batch file somewhere - on the desktop, for instance - and use it to rename files anywhere on your computer.
Open up your text editor, copy the code below and paste it into the editor (Notepad will work fine for this). Note that, while the meat of the thing is essentially the same, some of the percent signs are doubled. This is necessary for it to work from within a batch file. Don't worry too much with the why, just believe me.
@echo off set /p ext="File extension to look for: " %=% set /p suf="Suffix to add: " %=% set /p tdir="Target directory: " %=% cd %tdir% for /f "tokens=1* delims=." %%F in ('dir /b *.%ext%') do ( echo Renaming "%%F.%ext%" to "%%F%suf%.%ext%" rename "%%F.%ext%" "%%F%suf%.%ext%" ) echo All done! pause
In Notepad, you must change the file type selection to All Files before doing this; otherwise, Notepad will ever so helpfully stick a .txt extension onto your filename, and then it won't work.
After you've saved the file, run it by double-clicking its icon. After answering the prompts for extension, suffix and target directory, you'll see your files being renamed, then the "All Done!" message when the process completes. The pause at the end of the batch file ensures the command prompt window will remain on the screen after completion, prompting you to "Press any key to continue...".
This shot is what you'll see - in this case, I answered the prompts so that we'll look for all mp3 files in c:\Audio\Recording and add _ABC123 to their names.
At each prompt, simply type in what you want and then hit Enter.
Finally, here's what the files now look like, as seen in a normal Windows window: