System.IO.File.SetAttributes Method

Sets the specified System.IO.FileAttributes of the file on the specified path.

Syntax

public static void SetAttributes (string path, FileAttributes fileAttributes)

Parameters

path
The path to the file.
fileAttributes
A bitwise combination of the enumeration values.

Remarks

The path parameter is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see Directory.GetCurrentDirectory.

Certain file attributes, such as FileAttributes.Hidden and FileAttributes.ReadOnly, can be combined. Other attributes, such as FileAttributes.Normal, must be used alone.

It is not possible to change the compression status of a System.IO.File object using the File.SetAttributes(string, FileAttributes) method.

For a list of common I/O tasks, see Common I/O Tasks.

Requirements

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