Sets the date and time at which the specified file was last written.Some servers do not support this feature.
public override void SetLastWriteTime(
string path,
DateTime newDateTime
)
Public Overrides Sub SetLastWriteTime( _
ByVal path As String, _
ByVal newDateTime As DateTime _
)
public:
void SetLastWriteTime(
String^ path,
DateTime newDateTime
); override
Parameters
- path
- The file for which to set the date and time information.
- newDateTime
- A DateTime containing the value to set for the last write date and time of path.
Remarks
Support for setting modification date and time, either using MFMT or MDTM command, is not as widespread
as retrieving it. This method will fail on servers that support neither of these commands.
Shows how to use SetLastWriteTime method to set modification time of a file.
using System;
using ComponentPro.Net;
...
// Create a new class instance.
Ftp client = new Ftp();
// Connect to the FTP server.
client.Connect("myserver");
// Authenticate.
client.Authenticate("userName", "password");
// ...
// Set modification date and time of the remote file.
client.SetLastWriteTime("/file.dat", DateTime.Now);
// ...
// Disconnect.
client.Disconnect();
Imports ComponentPro.Net
...
' Create a new class instance.
Dim client As New Ftp()
' Connect to the FTP server.
client.Connect("myserver")
' Authenticate.
client.Authenticate("userName", "password")
' ...
' Set modification date and time of the remote file.
client.SetLastWriteTime("/file.dat", Date.Now)
' ...
' Disconnect.
client.Disconnect()