Get file attributes in CSharp

Description

The following code shows how to get file attributes.

Example


//from  w  ww  .  jav a 2 s  .c  om
using System;
using System.IO;

public class MainClass
{
    public static int Main(string[] args)
    {      
    FileInfo f = new FileInfo(@"C:\Test.txt");
    FileStream fs = f.Create();

    Console.WriteLine("Full name: {0}", f.FullName);
    Console.WriteLine("Full atts: {0}", f.Attributes.ToString());

    fs.Close();
    f.Delete();      

        return 0;
    }
}




















Home »
  C# Tutorial »
    IO »




File Attribute
File Security
Directory Attribute
Directory Recursive
Binary File
Text Field
Buffered IO
Create Copy Delete Move
CSV
Drive
File System Watcher
Isolated Storage
MemoryStream
Serialize
Zip