Link to home
Start Free TrialLog in
Avatar of Jeeck
Jeeck

asked on

How do I check if a ftp directory is empty?

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
Avatar of Amick
Amick
Flag of United States of America image

One way would be to examine the return from the ls command.
Avatar of Jeeck
Jeeck

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of Amick
Amick
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jeeck

ASKER

Just have to copy and paste. :-)