Question regarding Net::FTP

D

D. Alvarado

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
 
B

Bob Walton

D. Alvarado said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top