Created
October 26, 2011 08:49
-
-
Save kalabiyau/1315815 to your computer and use it in GitHub Desktop.
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
class Msgfile | |
MSGCONVERTER = "perl -w ~/bin/msgconvert.pl" | |
@path = Rails.root.join("tmp/docs").to_s | |
def self.convert_to_mime | |
Dir.chdir(@path) | |
fsnames = Dir[@path+"/*.msg"].map! {|f| escape_rus_filename(f)}.map!{|f| Rails.root.join(f).to_s } | |
fsgroups = fsnames.in_groups_of(6,false) | |
pids = fsgroups.map do |group| | |
group.map do |file| | |
@pid = Process.fork do | |
exec MSGCONVERTER << " #{file}" | |
end | |
end | |
end | |
pids.flatten.each { |pid| Process.waitpid(pid) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment