DirectoryInfo.GetFiles(String filter) : DirectoryInfo « System.IO « C# / C Sharp by API






DirectoryInfo.GetFiles(String filter)

  

using System;
using System.IO;

class MainClass {
    static void Main(string[] args) {
        DirectoryInfo dir = new DirectoryInfo("c:\\");
        FileInfo[] files = dir.GetFiles("c:\\a.txt");

        foreach (FileInfo file in files) {
            Console.Write("Name: " + file.Name + "  ");
            Console.WriteLine("Size: " + file.Length.ToString());
        }
    }
}

   
    
  








Related examples in the same category

1.new DirectoryInfo(String path)
2.DirectoryInfo.CreateSubdirectory
3.DirectoryInfo.CreationTime
4.DirectoryInfo.Exists
5.DirectoryInfo.FullName
6.DirectoryInfo.GetDirectories()
7.DirectoryInfo.GetFiles()
8.DirectoryInfo.LastAccessTime
9.DirectoryInfo.LastWriteTime
10.DirectoryInfo.Name
11.DirectoryInfo.Parent