iLTC Home
Bookmark iLTC!
iLTC Google Boards

Google Groups
Receive The Code in Email!



Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • Pass the Javascript, please...
    123,723

    iLoveTheCode.com
    Perl > Perl Tutorials How To Easy > To See if a Directory Exists in Perl

    To See if a Directory Exists in Perl



    To see if a directory already exists in Perl:

    if (-d "../citydata") {
    print "There is a directory named citydata!";
    }
    else {
    print "There is a no such directory.";
    }


    -We use -d to check for the directory.
    -We enclose the path to the directory in quotation marks. In this instance, one directory up is where we want to look for our directory citydata, so we use ../
    -We print the results of our checking.


    Copy and Paste Perl Code:

    #!/usr/bin/perl

    print "Content-type:text/html\n\n";

    if (-d "../citydata") {
    print "There is a directory named citydata!";
    }
    else {
    print "There is a no such directory.";
    }

    exit;


    Resources:
    Check for Existing File in Perl
    If, Elsif, and Else in Perl


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: Check for Existing File in Perl
    Next Article: To Sort an Array in Perl





    HTMLHTML

    Gary B. Shelly, Th...

    New $84.55

    Creating Web SitesCreating Web Sites

    Matthew MacDonald

    New $19.77

    HTML, XHTML, and CSS, Si...HTML, XHTML, and CSS, Sixth Edition ...

    Elizabeth Castro

    New $23.09

    Bulletproof Web DesignBulletproof Web Design

    Dan Cederholm

    New $23.99

    jQuery in ActionjQuery in Action

    Bear Bibeault, Yeh...

    New $26.39

    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $26.99

    CSSCSS

    Eric Meyer

    New $29.69

    New Perspectives on HTML...New Perspectives on HTML and XHTML 5...

    Partrick Carey

    New $67.45

    CSS MasteryCSS Mastery

    Andy Budd, Simon C...

    New $23.85


    Of Interest:
  • Create a Subroutine in Perl
  • And, Or, Equal, Not Equal, Greater Than, Less Than in Perl
  • Substitute in Perl
  • Redirect to a Different URL in Perl
  • Javascript Superscript Text
  • Exit a For Loop in Javascript with Break
  • Javascript Bold Text
  • Passing an Argument or Variable to a Javascript
  • HTML Subscript Text
  • HTML Color Chart
  • HTML Body Tag
  • HTML Tables

  • More Articles:
  • Undefine an Array in Perl
  • Putting Two Strings Together, Concatenate
  • To Reverse an Array in Perl
  • Finding the Length (Index Numbers) of an Array in Perl
  • onClick Javascript
  • Splitting an Array using Javascript
  • Match with a Regular Expression, REGEX, in Javascript
  • Increment a Variable in Javascript
  • Call your Function in Javascript
  • Make a Line Return Using HTML
  • HTML Body Tag
  • Make Italic Text Using HTML
  • Make a New Paragraph Using HTML

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    420,484
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:17 EDT