kartal
kartal

Reputation: 18096

Create text file and make it hidden and readOnly c#

How to Create text file and make it's Properties Hidden and Archive and ReadOnly using C#?

Upvotes: 11

Views: 10916

Answers (1)

Peter Kelly
Peter Kelly

Reputation: 14401

FileStream fs = File.Create("test.txt");
fs.Close();
File.SetAttributes(
   "test.txt", 
   FileAttributes.Archive | 
   FileAttributes.Hidden | 
   FileAttributes.ReadOnly
   );

Upvotes: 23

Related Questions