This project is read-only.

File Size

Mar 1, 2007 at 12:20 AM
Edited Mar 1, 2007 at 12:21 AM

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 4: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 11:39 AM
Edited Mar 6, 2007 at 11: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 3:07 PM
Can you confirm what "filename" is set to when you requested it.. it should look like "/dir1/dir2/myfile.ext"