Mono Class Library: System.IO.Directory Overview | Members

System.IO.Directory.SetLastWriteTime Method

Sets the date and time a directory was last written to.

public static void SetLastWriteTime (string path, DateTime lastWriteTime)

Parameters

path
A string containing the name of the directory for which to set the date and time information.
lastWriteTime
A DateTime containing the value to set for the last write date and time of path. This value is expressed in local time.

Permissions

TypeReason
System.Security.Permissions.FileIOPermissionRequires permission to write to the specified file. See System.Security.Permissions.FileIOPermissionAccess.Write.

Exceptions

TypeReason
ArgumentExceptionpath is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.
ArgumentNullExceptionpath is null.
System.IO.IOExceptionAn I/O error occurred while performing the operation.
System.IO.PathTooLongExceptionThe length of path or the absolute path information for path exceeds the system-defined maximum length.
System.Security.SecurityExceptionThe caller does not have the required permission.
ArgumentOutOfRangeExceptionlastWriteTime specifies a value outside the range of date/times permitted for this operation.
System.IO.FileNotFoundExceptionpath was not found.
UnauthorizedAccessExceptionThe caller does not have the required permission.

Remarks

Relative path information is interpreted as relative to the current working directory.

Note: To obtain the current working directory, see Directory.GetCurrentDirectory.

On platforms that do not support this feature, this method has no effect. If this feature is supported, the range of dates that is valid for this operation is implementation-specific.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0