39 users online (0 members and 39 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 2
  2. Replies: 2
  3. Checking the contents of a folder for images    Forum: Javascript Forum
    Replies: 0
  4. Replies: 6
  5. Folder referencing    Forum: HTML Forum
    Replies: 2
  1. #1
    Lamont1701's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2005
    Location
    New Jersey, USA
    Posts
    18

    Script, Checking To See If Folder Exist -- If Not Create That Folder

    Hello People,

    I need a Windows 2003, Perl 5 Script that will check to see if a Folder exist, and if the Folder does not exist, then create that Folder. (If the Folder does exist, then do nothing.)

    I know nothing about Perl 5 yet, but I have a script running now that needs attention, like yesterday!


    Is it possible for someone to help me?

  2. #2
    uthus's Avatar
    Senior Member

    Status
    Offline
    Join Date
    Feb 2006
    Location
    Ft Hood
    Posts
    75

    Re: Script, Checking To See If Folder Exist -- If Not Create That Folder

    Hi,
    Code:
    $filename = "/users/abc123/text.txt"; 
     
    if(-e $filename){ 
     
      print "File exists."; 
     
    } else {
    
      mkdir ($filename);
    
    }
    This should work. You'd just need to change the path to c:\whatever\ (or d:, e:, etc.)

    HTH

    U



Tags for this Thread