Archived Forum Post

Index of archived forum posts

Question:

GetSizeByName is case-sensitive connecting to Windows 2000?

Aug 29 '14 at 13:02

Is this a bug, or just something weird about Windows 2000 SP4?

I am using FTP2 version 9.4.1.42, ActiveX version, called by FoxPro. It is running on Windows Server 2008 R2 Standard SP1.

When I connect to a Windows 2000 SP4 server in Passive mode, and do GetSizeByName(XYZ.TXT), it fails to find XYZ.txt (lowercase 'txt' extension). It returns a size value of -1. When I connect to Windows 2003, it does not fail to find XYZ.txt. It returns a nonzero size value. The file size in both cases is under 1KB.

GetFile does not care about case; it will get XYZ.TXT or XYZ.txt when told to get XYZ.TXT.


Answer

Here's a new build that may resolve the problem:

64-bit: http://www.chilkatsoft.com/download/preRelease/ChilkatAx-9.5.0-x64.zip
32-bit: http://www.chilkatsoft.com/download/preRelease/ChilkatAx-9.5.0-win32.zip

There may be no perfect solution. If the FTP server supports the SIZE command, then Chilkat will use it to retrieve the file size info (as opposed to downloading the entire directory listing over a separate data connection). The problem is that the FTP server will likely be case-sensitive w.r.t. the filename passed in the SIZE command.

If the size information is retrieved by fetching a directory listing, then Chilkat will use a case-insensitive match on the filename. If two files have identical names except for case (which can happen on server-side filesystems that are case-sensitive, such as w/ Linux), then Chilkat will return the exact match first, then the inexact match (using the new build, which will become v9.5.0.44).

If your FTP server has the SIZE command, I think it's possible to avoid it by first making a call that forces the directory listing to be retrieved. You would do this via the GetDirCount method (which is new in this upcoming version. The GetDirCount method will replace the deprecated NumFilesAndDirs property because we don't want a property that behind-the-scenes involves network communications. The GetDirCount will force the directory listing to be retrieved and cached in memory. The GetSizeByName method should then use the cached size info (if available).