Use file filer on a directory : Directory « File Directory Stream « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » File Directory Stream » Directory 
15.15.2.Use file filer on a directory
using System;
using System.IO;

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

        // Display the name of all the files.
        foreach (FileInfo file in files)
        {
            Console.Write("Name: " + file.Name + "  ");
            Console.WriteLine("Size: " + file.Length.ToString());
        }

    }
}
15.15.Directory
15.15.1.Get the files from the root directory
15.15.2.Use file filer on a directory
15.15.3.Directory.Exists
15.15.4.Get Current Directory
15.15.5.Get relative path
15.15.6.Changing current directory to c:\\
15.15.7.Delete Directory
15.15.8.Directory Attributes
15.15.9.Use DirectoryInfo to create sub directory
15.15.10.List directory under a directory
15.15.11.List files under a directory
15.15.12.All Directories traverses all sub-directories under the root
15.15.13.Traverse all files under the root
15.15.14.Recursive Directory use
15.15.15.Get DirectoryInfo from FileInfo: name, parent directory name, directory exists
15.15.16.DirectoryInfo: creation time, last write time, last access time
15.15.17.DirectoryInfo: Directory attribute list and Directory contains
15.15.18.Using Directory type
15.15.19.Recursely Explore Directories
15.15.20.Show basic directory info
15.15.21.Modify directory structure
15.15.22.Creating Subdirectory and Manipulating File
15.15.23.Exploring Files And Sub directories
15.15.24.Create directory structure
15.15.25.Get all cs file from current directory, display its creation time, length, name
15.15.26.Use the GetFiles method to return file names from a user-specified location.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.