Get all cs file from current directory, display its creation time, length, name in CSharp

Description

The following code shows how to get all cs file from current directory, display its creation time, length, name.

Example


     //w w w  . j ava 2s.  c o m
using System;
using System.IO;
class Dir
{
  public static void Main()
  {
    FileInfo[] files = new DirectoryInfo(Environment.CurrentDirectory).GetFiles("*.cs");
    foreach (FileInfo file in files)
    {
      Console.WriteLine("{0}\t{1}\t\t{2}",
        file.CreationTime,file.Length,file.Name);
    }    
  }
}




















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