Home Forums .NET libraries Xceed SFTP/FTP for .NET Xceed.FileSystem.AbstractFolder.GetFile() case sensitivity

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #21436 |

    There are only two overloads for this method. My files that I’m trying to download are acting like they don’t exist, even though they do. It appears as though this method is case-sensitive, even though the documentation says that it’s not. I’m trying to download *.zip files (but they are actually *.ZIP). How do ignore case?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 1074 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi ganders,

    I gather the AbstractFile is an FTPFile object?

    Case sensitivity depends on the actual target file system.

    For DiskFile/DiskFolder, names are case insensitive because the Windows file system is case insensitive.

    For FTPFile and FTPFolder, it is not as clear cut unfortunately. It depends of the FTP server you are connected to. Some FTP servers are case sensitive, others are not. The FTP specification does not enforce a specific rule. Based on this, it would appear that your server is case-sensitive.

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 181 views)

    User (Old forums)
    Member
    Post count: 23064

    Is there a way to specify in my method call to ignore case? Or do I need to call the GetFiles method and send a name filter with a less than, like this: AbstractFolder.GetFiles(“<fiLEname.ziP”);

     This is an FTPFolder… 

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by ganders (had 181 views)

    Diane [Xceed]
    Moderator
    Post count: 1353

    Hi ganders,

    By default, the NameFilter class is not case sensitive, but it can be forced to act as case sensitive by using “>”.

    Documentation:
    http://doc.xceedsoft.com/products/XceedFileSystem/#topic262.html

    Using NameFilter normally makes it case insensitive. When GetFiles() is called, FtpFolder asks the server for all the files without using wildcards or masks. From the list that the server returns, the component then filters the results according to the Filter objects passed to GetFiles(), if any.

    Based on this information, code like this:

      AbstractFolder folder = new FtpFolder( ftp );
      AbstractFile[] files = folder.GetFiles( false, “*.zip” );

    should give you both “.zip” files and “.ZIP” files, and everything in between.

    If you are not getting them, then maybe they aren’t part of the original file list. Are you sure you are listing the correct directory?

    If you use the following code:

      AbstractFile[] files = folder.GetFiles( false );

    do you get all the files you would expect to be in that directory?

    Applies to Xceed FTP for .NET. Imported from legacy forums. Posted by Diane [Xceed] (had 1252 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.