FileSystemInfo Class provides the base class for both FileInfo and DirectoryInfo objects. : FileInfo « File Directory « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » File Directory » FileInfoScreenshots 
FileSystemInfo Class provides the base class for both FileInfo and DirectoryInfo objects.
 

Imports System.IO
Module Module1
    Sub Main()
        For Each entry As String In Directory.GetDirectories("C:\")
            DisplayFileSystemInfoAttributes(New DirectoryInfo(entry))
        Next
        For Each entry As String In Directory.GetFiles("C:\")
            DisplayFileSystemInfoAttributes(New FileInfo(entry))
        Next
    End Sub

    Sub DisplayFileSystemInfoAttributes(ByVal fsi As IO.FileSystemInfo)
        Dim entryType As String = "File"
        If (fsi.Attributes And FileAttributes.Directory) = FileAttributes.Directory Then
            entryType = "Directory"
        End If
        Console.WriteLine("{0entry {1was created on {2:D}",entryType, fsi.FullName, fsi.CreationTime)
    End Sub
End Module

   
  
Related examples in the same category
1.FileInfo Class provides properties and instance methods for the creation, copying, deletion, moving, and opening of files
2.FileInfo provides properties and instance methods for the creation, copying, deletion, moving, and opening of files
3.Create FileInfo class
4.Use FileInfo.AppendText to create StreamWriter and add text to it
5.FileInfo.CopyTo copies a file
6.Use FileInfo open a file to read
7.FileInfo.CopyTo (String, Boolean) copies a file, allowing the overwriting of an existing file.
8.FileInfo.Create
9.FileInfo.CreateText creates a StreamWriter that writes a new text file.
10.FileInfo.Decrypt decrypts a file that was encrypted using the Encrypt method.
11.FileInfo.Delete deletes a file.
12.FileInfo.Directory Property gets an instance of the parent directory.
13.FileInfo.DirectoryName Property gets a string representing the directory's full path.
14.FileInfo.GetAccessControl gets a FileSecurity object that encapsulates the access control list (ACL) entries
15.FileInfo.IsReadOnly Property gets or sets a value that determines if the current file is read only.
16.FileInfo.Length Property gets the size, in bytes, of the current file.
17.FileInfo.Name Property gets the name of the file.
18.FileInfo.Open opens a file in the specified mode.
19.FileInfo.Open (FileMode, FileAccess) opens a file in the specified mode with read, write, or read/write access.
20.FileInfo.Open with settings for File Read Write Mode, File Access Mode, File Share Mode
21.FileInfo.OpenRead creates a read-only FileStream.
22.FileInfo.OpenText creates a StreamReader with UTF8 encoding that reads from an existing text file.
23.FileInfo.OpenWrite creates a write-only FileStream.
24.FileInfo.Replace replaces the contents of a file
25.FileInfo.Length Property tells the size, in bytes, of the current file.
ww___w_.j_av___a2s.com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.