Set file attribute
In this chapter you will learn:
Change file attribute
using System;//from ja va2 s. c o m
using System.IO;
class Class1
{
[STAThread]
static void Main(string[] args)
{
if( args[1] == "+r" )
{
File.SetAttributes( args[0], File.GetAttributes(args[0]) | FileAttributes.ReadOnly );
}
else if( args[1] == "-r" )
{
File.SetAttributes( args[0], File.GetAttributes(args[0]) & (~FileAttributes.ReadOnly) );
}
}
}
Next chapter...
What you will learn in the next chapter:
Home » C# Tutorial » File, Path