Created
February 17, 2010 04:15
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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