NET SFTP Library
SortDirectoryListing Method
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP Class : SortDirectoryListing Method
A directory listing from the GetDirectoryListing method
Float directories to the top
What column to sort on
If true, sort the list ascending, otherwise sort descending
Sort an FTP Directory Listing
Syntax
'Declaration
 
Public Function SortDirectoryListing( _
   ByVal directoryListing As System.Collections.Generic.List(Of FTPFileInfo), _
   ByVal directoriesOnTop As System.Boolean, _
   ByVal sortColumn As FtpSortColumn, _
   ByVal ascending As System.Boolean _
) As System.Collections.Generic.List(Of FTPFileInfo)
'Usage
 
Dim instance As SFTP
Dim directoryListing As System.Collections.Generic.List(Of FTPFileInfo)
Dim directoriesOnTop As System.Boolean
Dim sortColumn As FtpSortColumn
Dim ascending As System.Boolean
Dim value As System.Collections.Generic.List(Of FTPFileInfo)
 
value = instance.SortDirectoryListing(directoryListing, directoriesOnTop, sortColumn, ascending)
public System.Collections.Generic.List<FTPFileInfo> SortDirectoryListing( 
   System.Collections.Generic.List<FTPFileInfo> directoryListing,
   System.bool directoriesOnTop,
   FtpSortColumn sortColumn,
   System.bool ascending
)
public function SortDirectoryListing( 
    directoryListing: System.Collections.Generic.List;
    directoriesOnTop: System.Boolean;
    sortColumn: FtpSortColumn;
    ascending: System.Boolean
): System.Collections.Generic.List; 
public function SortDirectoryListing( 
   directoryListing : System.Collections.Generic.List,
   directoriesOnTop : System.boolean,
   sortColumn : FtpSortColumn,
   ascending : System.boolean
) : System.Collections.Generic.List;
public: System.Collections.Generic.List<FTPFileInfo*>* SortDirectoryListing( 
   System.Collections.Generic.List<FTPFileInfo*>* directoryListing,
   System.bool directoriesOnTop,
   FtpSortColumn sortColumn,
   System.bool ascending
) 
public:
System.Collections.Generic.List<FTPFileInfo^>^ SortDirectoryListing( 
   System.Collections.Generic.List<FTPFileInfo^>^ directoryListing,
   System.bool directoriesOnTop,
   FtpSortColumn sortColumn,
   System.bool ascending
) 

Parameters

directoryListing
A directory listing from the GetDirectoryListing method
directoriesOnTop
Float directories to the top
sortColumn
What column to sort on
ascending
If true, sort the list ascending, otherwise sort descending
Example
SFTP sftp = new SFTP(); //Trial Mode            
            //SFTP sftp = new SFTP("place user name here", "place license key here");
             
            // set the name of the SSH server( its URL )
            sftp.HostAddress = "some.sftp.server.com"; // replace with your SFTP server
            sftp.UserName  = "anonymous"; // replace with your user name
            sftp.Password = "user@mail.com"; // replace with your password
             
            List<FtpFileInfo> sortedList= sftp.SortDirectoryListing(GetDirectoryListing(), directoriesOnTop, sftp.FtpSortColumn.FileName, true);
Dim sftp As SFTP = New SFTP() 'Trial Mode
            'Dim sftp As SFTP = New SFTP("place user name here", "place license key here");
             
            ' set the name of the SSH server( its URL )
            sftp.HostAddress = "some.sftp.server.com" ' replace with your SFTP server
            sftp.UserName  = "anonymous" ' replace with your user name
            sftp.Password = "user@mail.com" ' replace with your password
             
            List And lt
            FtpFileInfo And gt
            sortedList= sftp.SortDirectoryListing(GetDirectoryListing(), directoriesOnTop, sftp.FtpSortColumn.FileName, True)
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

SFTP Class
SFTP Members