Question regarding Net::FTP

Discussion in 'Perl Misc' started by D. Alvarado, Nov 25, 2003.

  1. D. Alvarado

    D. Alvarado Guest

    Hello,
    I have a simple question regarding this helpful module. I would
    like to know how to check if a remote directory exists, and if in
    fact, that is indeed a directory. Thanks in advance, Dave
    D. Alvarado, Nov 25, 2003
    #1
    1. Advertising

  2. D. Alvarado

    Bob Walton Guest

    D. Alvarado wrote:

    > Hello,
    > I have a simple question regarding this helpful module. I would
    > like to know how to check if a remote directory exists, and if in
    > fact, that is indeed a directory. Thanks in advance, Dave
    >


    One way would be to use the ->dir method on a Net::FTP session object.
    Then peruse the results of that method to see if your desired directory
    is present or not. I think perhaps the format of the listing could vary
    depending upon the remote FTP server, as the ->dir method returns what
    the remote server sends.

    You could also use the ->cwd method to attempt to change directory to
    your directory -- if it fails, you could assume the directory doesn't exist.

    --
    Bob Walton
    Email: http://bwalton.com/cgi-bin/emailbob.pl
    Bob Walton, Nov 25, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    5,634
  2. Nico Grubert
    Replies:
    0
    Views:
    641
    Nico Grubert
    Nov 24, 2005
  3. Nico Grubert
    Replies:
    0
    Views:
    446
    Nico Grubert
    Nov 25, 2005
  4. Vin Raja

    FTP : Time problem (net/ftp)

    Vin Raja, Jun 7, 2007, in forum: Ruby
    Replies:
    0
    Views:
    100
    Vin Raja
    Jun 7, 2007
  5. D. Buck
    Replies:
    2
    Views:
    483
    D. Buck
    Jun 29, 2004
Loading...

Share This Page