NET FTP Library
SortDirectoryListing Method
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP 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 FTP
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
FTP ftp = new FTP(); //Trial Mode            
//FTP ftp = new FTP("place user name here", "place license key here");
 
// set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu"; // a hungarian university. change this to your ftp server
ftp.UserName = "anonymous"; // replace with your user name
ftp.Password = "user@mail.com"; // replace with your password
 
List<FtpFileInfo> sortedList= ftp.SortDirectoryListing(GetDirectoryListing(), directoriesOnTop, FTP.FtpSortColumn.FileName, true);
Dim ftp As FTP = New FTP() 'Trial Mode
'FTP ftp = new FTP("place user name here", "place license key here");
 
' set the name of the FTP server( its URL )
ftp.HostAddress = "ftp.fsz.bme.hu" ' a hungarian university. change this to your ftp server
ftp.UserName = "anonymous" ' replace with your user name
ftp.Password = "user@mail.com" ' replace with your password
 
List And lt
FtpFileInfo And gt
sortedList= ftp.SortDirectoryListing(GetDirectoryListing(), directoriesOnTop, FTP.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

FTP Class
FTP Members