The previously accepted answer:
File.SetAttributes(path, FileAttributes.Hidden);
will result in certain other attributes it may have being lost, so you should:
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);
The previously accepted answer:
File.SetAttributes(path, FileAttributes.Hidden);
will result in certain other attributes it may have being lost, so you should:
File.SetAttributes(path, File.GetAttributes(path) | FileAttributes.Hidden);