ruby - Trouble Creating Directories with mkdir -


new ruby, silly

trying make directory in order store files in it. here's code so

def generateparsedemailfile     apath = file.expand_path($textfile)     filepath = pathname.new(apath + '/' + @subject + ' ' + @date)     if filepath.exist?         filepath = pathname.new(filepath+ '.1')     end     directory = dir.mkdir (filepath)     dir.chdir directory     emailtext = file.new("emailtext.txt", "w+")     emailtext.write(self.generatetext)     emailtext.close     attachment in @attachments         self.generateattachment(attachment,directory)     end end 

here's error get

my-name-macbook-2:emails myname$ ruby etext.rb email4.txt etext.rb:196:in `mkdir': not directory - /users/anthonydreessen/developer/ruby/emails/email4.txt/re: make brief report wed 8 may 2013 (errno::enotdir)     etext.rb:196:in `generateparsedemailfile'     etext.rb:235:in `<main>' 

i able recreate error - looks email4.txt regular file, not directory, can't use part of directory path.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -