Skip to content

Instantly share code, notes, and snippets.

@timander
Created February 17, 2010 04:15
Show Gist options
  • Save timander/306288 to your computer and use it in GitHub Desktop.
Save timander/306288 to your computer and use it in GitHub Desktop.
My hacked together ruby code to combine several mp3 audiobook chapters files into one file
#!/bin/ruby
require 'find'
require 'fileutils'
def combine_mp3_files(final_mp3)
`rm #{final_mp3}`
files = []
Find.find('.') do |path|
if FileTest.file?(path)
if File.basename(path).include? ".mp3"
#puts path
files << path
end
end
end
files.sort!
files.each do |file|
puts "#{file}"
`cat "#{file}" >> #{final_mp3}`
end
end
combine_mp3_files('my_big_file.mp3')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment