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. Advertisements

  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. Advertisements

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. someone

    FTP over SSL vs FTP over SSH

    someone, Apr 24, 2004, in forum: Java
    Replies:
    1
    Views:
    4,854
    iksrazal
    Apr 25, 2004
  2. Replies:
    3
    Views:
    6,444
  3. Nico Grubert
    Replies:
    0
    Views:
    861
    Nico Grubert
    Nov 24, 2005
  4. Vin Raja

    FTP : Time problem (net/ftp)

    Vin Raja, Jun 7, 2007, in forum: Ruby
    Replies:
    0
    Views:
    223
    Vin Raja
    Jun 7, 2007
  5. Ari Brown

    Net::FTP and ftp.dir()

    Ari Brown, Jul 16, 2007, in forum: Ruby
    Replies:
    0
    Views:
    184
    Ari Brown
    Jul 16, 2007
  6. Jeff Miller
    Replies:
    0
    Views:
    842
    Jeff Miller
    Mar 26, 2009
  7. D. Buck
    Replies:
    2
    Views:
    919
    D. Buck
    Jun 29, 2004
  8. bala

    ftp nmap support in Net::FTP

    bala, Mar 25, 2005, in forum: Perl Misc
    Replies:
    6
    Views:
    216
    Matija Papec
    Mar 29, 2005
Loading...