File Size

Feb 28, 2007 at 11:20 PM
Edited Feb 28, 2007 at 11:21 PM

I have some problems retrieving the file size with the command myftp.GetFileSize(filename). I always get the error: "The remote server returned an error: (550) File unavailable (e.g., file not found, no access)."

But when i use:

Dim Elements As FtpClientVB.Utilities.FTP.FTPdirectory = FTP_DLL.ListDirectoryDetail(path)
For Each Element as FtpClientVB.Utilities.FTP.FTPfileInfo in Elements

i get the size
Mar 5, 2007 at 3:41 PM
It is possible you are trying to read the size for a directory entry. The ListDirectoryDetail() function returns a list of files and subdirectories.

Try filtering only for file entries:

For Each Element as FtpClientVB.Utilities.FTP.FTPfileInfo in Elements.GetFiles()
Mar 6, 2007 at 10:39 AM
Edited Mar 6, 2007 at 10:40 AM
nono, the second method (ListDirectoryDetail) returns the size, but the first method (myftp.GetFileSize(filename)) doesn't. This is puzzling me
Mar 7, 2007 at 2:07 PM
Can you confirm what "filename" is set to when you requested it.. it should look like "/dir1/dir2/myfile.ext"