From: matz@... (Yukihiro Matsumoto) Date: 2002-12-04T09:08:39+09:00 Subject: Re: Creating directories with File.open Hi, In message "Creating directories with File.open" on 02/12/04, Jason Persampieri writes: |I'm attempting to create a file within a directory |structure that may or may not exist yet. | |File.open("tempdir/foo.txt","w") fails seemingly |because the 'tempdir' directory does not yet exist. |Is this proper behavior? If the user wants to create |the FILE, why would File#open assume they wouldn't |want to create the underlying directory as well? | |Is there another method that WOULD go ahead and create |the directory for me? Put require 'ftools' File.mkpath "tempdir" or require 'fileutils' FileUtils.mkpath "tempdir" before "open". matz.