Hey i am trying to read the list of file names in a directory and my ftpfindfirstfile works but my internetFindNextFile does not. could anyone possibly give me a hand if they have worked with this before?
here is the code, i know i can open and connect properly, and all of my varibles are declared properly, so for the sake of security (and readability) im just going to post the part that applies
hFileConnection = FtpFindFirstFile(hConnection, "*.csv", win32Con, 0, 0)
If hFileConnection Then
bResult = True
Do While bResult
ReDim Preserve sFileNames(i) 'this is like adding another element to the array because each time it goes through the loop i increases by one
nFileSize = InStr(1, win32Con.cFileName, Chr(0)) - 1
If nFileSize = 0 Then 'Null character (delimeter) not found
nFileSize = Len(win32Con.cFileName)
End If
sFileNames(i) = Mid(win32Con.cFileName, 1, nFileSize)
bResult = InternetFindNextFile(hFileConnection, win32Con)
i = i + 1
Loop
If hFileConnection Then 'now that we are done
CloseFtpConnection 'loading data we can close the file
End If 'connection, if there was one open
End If
here is the code, i know i can open and connect properly, and all of my varibles are declared properly, so for the sake of security (and readability) im just going to post the part that applies
hFileConnection = FtpFindFirstFile(hConnection, "*.csv", win32Con, 0, 0)
If hFileConnection Then
bResult = True
Do While bResult
ReDim Preserve sFileNames(i) 'this is like adding another element to the array because each time it goes through the loop i increases by one
nFileSize = InStr(1, win32Con.cFileName, Chr(0)) - 1
If nFileSize = 0 Then 'Null character (delimeter) not found
nFileSize = Len(win32Con.cFileName)
End If
sFileNames(i) = Mid(win32Con.cFileName, 1, nFileSize)
bResult = InternetFindNextFile(hFileConnection, win32Con)
i = i + 1
Loop
If hFileConnection Then 'now that we are done
CloseFtpConnection 'loading data we can close the file
End If 'connection, if there was one open
End If