SetFileAttributes (kernel32)
Last changed: -129.94.142.244

.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern bool SetFileAttributes(string lpFileName, uint dwFileAttributes);

Alternative C# Signature:

[DllImport("kernel32.dll")]
static extern bool SetFileAttributes(
     string lpFileName,
     [MarshalAs(UnmanagedType.U4)] FileAttributes dwFileAttributes);

User-Defined Types:

None.

Notes:

This method works for Alternate Data Streams.

Tips & Tricks:

Please add some!

Sample Code:

Using the "alternative" method above you can make calls like so:

SetFileAttributes("pathname", FileAttributes.System | FileAttributes.Hidden | FileAttributes.Archive);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation