NET SFTP Library
GetFileDate Method
Example 






KellermanSoftware.NetSFtpLibrary Namespace > SFTP 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 SFTP
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
SFTP sftp = new SFTP(); //Trial Mode            
//SFTP sftp = new SFTP("place user name here", "place license key here");
 
// set the name of the SFTP 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
 
//Gets the file size of a remote file 
DateTime dateTime = sftp.GetFileDate("a.txt");
 
System.Console.WriteLine("a.txt was created on {0}", dateTime.ToString());
Dim sftp As SFTP = New SFTP() 'Trial Mode
'Dim sftp = New SFTP("place user name here", "place license key here")
 
' set the name of the SFTP 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
 
'Gets the file size of a remote file
Dim dateTime As DateTime = sftp.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

SFTP Class
SFTP Members