NET FTP Library
GetFileDate Method
Example 






KellermanSoftware.NetFtpLibrary Namespace > FTP Class : GetFileDate Method
Name of file in the current directory
Gets the modification date of a remote file.
Syntax
'Declaration
 
Public Function GetFileDate( _
   ByVal fileName As System.String _
) As System.Date
'Usage
 
Dim instance As FTP
Dim fileName As System.String
Dim value As System.Date
 
value = instance.GetFileDate(fileName)
public System.DateTime GetFileDate( 
   System.string fileName
)
public function GetFileDate( 
    fileName: System.String
): System.DateTime; 
public function GetFileDate( 
   fileName : System.String
) : System.DateTime;
public: System.DateTime GetFileDate( 
   System.string* fileName
) 
public:
System.DateTime GetFileDate( 
   System.String^ fileName
) 

Parameters

fileName
Name of file in the current directory

Return Value

The modification date or DateTime(0) if it fails
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
 
//Gets the file size of a remote file 
DateTime dateTime = ftp.GetFileDate("a.txt");
 
System.Console.WriteLine("a.txt was created on {0}", dateTime.ToString());
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
 
'Gets the file size of a remote file
Dim dateTime As DateTime = ftp.GetFileDate("a.txt")
 
System.Console.WriteLine("a.txt was created on {0}", dateTime.ToString())
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