SPUG: Yet another silly question

Jim Flanagan jimfl at colltech.com
Sat Jan 19 16:45:55 CST 2002


--On Saturday, January 19, 2002 2:22 PM -0800 Susanne Bullo 
<sweetsue at sweethomes.com> wrote:

     > Ok, I am trying to figure out the coding for checking to see if a
     > directory exists and if it doesn't, create it.  I've gotten out my
     > "Perl For Dummies" book and did a lot of searching and am still
     > stumped.  Anyone have a quick and easy answer for me?

    use File::Path;
    mkpath($dir) unless -d $dir;

  Take a look at the manual page for File::Path. There are some other
  options you can set in the call to mkpath, that may apply to your
  project. But you asked for the quick and easy version :^)

-- 
Jim Flanagan
jimfl at colltech.com

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list