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
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
One way would be to examine the return from the ls command.
ASKER
This is what I am doing
Dim strFileName as string() = Strings.Split(newFTP.ListDirectory("/MyDirec tory/")(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?
Dim strFileName as string() = Strings.Split(newFTP.ListDirectory("/MyDirec
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Just have to copy and paste. :-)