We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

How do I check if a ftp directory is empty?

Jeeck
Jeeck asked
on
Medium Priority
1,142 Views
Last Modified: 2013-11-26
Hello
I am writing an application to connect to a ftp server, and read the ftp files in a a ftp directory. How do I check if the ftp directory is empty or not? Any suggestions will be appreciate
Comment
Watch Question

Commented:
One way would be to examine the return from the ls command.

Author

Commented:
This is what I am doing
Dim strFileName  as string() = Strings.Split(newFTP.ListDirectory("/MyDirectory/")(0), vblf)I
This code works fine if I have files in the directory. But, of Course, if there are no files in the directory, it doesn't work anymore. I am thinking about checking  newFTP.ListDirectory("/MyDirectory/") first, but don't know. I am trying all combinations but not succes yet.
If newFTP.ListDirectoryDetail("/ClientUpdateLog/") Is Nothing Then

              '  Do nothing
 End If
Can you be specific about the Is command?
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Just have to copy and paste. :-)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.