From: w_a_x_man Date: 2010-12-31T09:20:20+09:00 Subject: Re: From python to ruby On Dec 30, 3:54 am, Alain Matthes wrote: > On 2010-12-29 22:05:23 +0100, w_a_x_man said: > > > > > require 'ftools' > > > HEADER = '\input{Vorspann.ltx} > > > \begin{document} > > > %s > > \end{document} > > ' > > > File.makedirs( "new" ) > > > Dir[ "*.tex" ].each{|fname| > >    text = IO.read( fname ) > >    text2 = HEADER % text > >    File.open( "new/" + fname, "wb" ){|fh| > >     fh.print text2 > >   } > > } > > With ruby 1.9, the only thing to change, is to use  fileutils instead > of ftools  ? > > AM If 1.9 lacks ftools, then require "fileutils" and replace File.makedirs( "new" ) with FileUtils.mkdir( "new" )