From: konsu Date: 2006-02-02T06:42:12+09:00 Subject: Re: check for and if not there, create direcory and file hello, may be it would fail. but you have the other method(s) that you can use to check if the directory exists. konstantin "charlie bowman" wrote in message news:5d2bdb4af4e0aab57e66d7fe58f508ac@ruby-forum.com... > irb(main):002:0> Dir.mkdir(".timeclock") > won't the above faile once the directory is created. I need to run a > check each time the application is ran. > > > > Matthew Smillie wrote: >> On Jan 30, 2006, at 16:39, charlie bowman wrote: >> >>> >>> I'm making a little app that requires this folder .timeclock/filename >>> >>> The first time the app runs I would like it to check to see if the >>> folder and file are there and if not, create them. Everything I've >>> tried >>> crashes if the folder isn't there. Thanks for any help! >> >> These methods might help you out with creating the directory: >> >> irb(main):001:0> File.exist?(".timeclock") >> => false >> irb(main):002:0> Dir.mkdir(".timeclock") >> => 0 >> irb(main):003:0> File.exist?(".timeclock") >> => true >> irb(main):004:0> File.directory?(".timeclock") >> => true >> >> From there you should be able to just open .timeclock/new_file as >> one normally would. >> >> matthew smillie. > > > -- > Posted via http://www.ruby-forum.com/. > >