GetDirectoryInfo Method


GetDirectoryInfo Method

Location

My.Computer.FileSystem.GetDirectoryInfo

Syntax

     Dim result As System.IO.DirectoryInfo = _        My.Computer.FileSystem.GetDirectoryInfo(path) 


path (required; String)

The path to the directory to be examined; an absolute or relative path

Description

The GetDirectoryInfo method returns a System.IO.DirectoryInfo object for the indicated directory.

Public Members

The returned System.IO.DirectoryInfo object includes the following notable public members.

Member

Description

Create

Method. Creates the directory itself. Only useful when the Exists member returns False.

CreateSubdirectory

Method. Creates a subdirectory within the directory.

Delete

Method. Deletes the directory.

Exists

Property. Indicates whether the directory exists (true) or not (False).

FullName

Property. The full path text of the directory.

Getdirectories

Method. Returns a collection of subdirectories in the directory.

GetFiles

Method. Returns a collection of files in the directory.

MoveTo

Method. Moves the directory to a different location on the same drive.

Name

Property. The name of the directory without its full path.

Parent

Property. The parent folder of the directory.

Root

Property. The root directory that contains the directory, such as "C:\."


Usage at a Glance

  • An exception is thrown if the path parameter is missing or invalid.

  • An exception is thrown if the user lacks sufficient file-access privileges.

  • If the indicated directory path does not exist, this function may complete successfully with no exception thrown. However, an exception will be thrown when accessing most members of the returned object. Use the Exists property to test for the directory if you are unsure of its existence, or use the Create method member to create the new indicated directory.

Related Framework Entries

  • Microsoft.VisualBasic.MyServices.FileSystemProxy.GetDirectoryInfo Method

  • Microsoft.VisualBasic.FileIO.FileSystem.GetDirectoryInfo Method

  • System.IO.DirectoryInfo Class

See Also

CurrentDirectory Property, Drives Property, FileSystem Object, FindInFiles Method, GetDirectories Method, GetDriveInfo Method, GetFileInfo Method, GetFiles Method, GetTempFileName Method




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net