Merge MP3 files with the Unix command cat

Feb 12, '04 09:26:00AM

Contributed by: dogen

Use cat to merge chapters of an audiobook or other multipart files you may prefer to consolidate. You might proceed as follows:

  1. Create a temporary directory for the files to concatenate
  2. cd to the directory in Terminal
  3. Use the wildcard (*) to merge the files in the order in which they appear in the directory, and > redirection to create a single file, e.g.:
    
     % cat * > xxx.mp3
    
If you've got a heap of files and don't feel like mousing, set up a subfolder as the working directory inside the folder with the files to concatenate. You can then wildcard the files to the working directory subfolder with something like this:

 % mv ../abc* ./
When finished, move the merged file to the parent directory with mv xxx.mp3 ../, then delete the parts in the working directory with rm *. It's a good idea to back up the files before you begin -- otherwise, you may rm away your material inadvertently.

Comments (20)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040205164724481