Results 1 to 3 of 3

Thread: Checking if a file exist in Perl? [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Unhappy Checking if a file exist in Perl? [RESOLVED]

    How can I check to see if a file exist on the server using Perl? Is there a function similar to Visual Basic's Dir function?

    I know I can use or die to print an error to the server error log but I've yet been able to figure out how to tell my CGI script that the file does not exist.

    Thanks!
    Last edited by RealisticGraphics; Mar 13th, 2003 at 06:28 PM.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  2. #2
    Member
    Join Date
    Jan 2003
    Posts
    44
    Code:
    if (-e 'filename') {
        # file exists
    } else {
        # file does not exists
    }

  3. #3

    Thread Starter
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    That worked great! Thanks!
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width