.NET
  Home arrow .NET arrow Page 3 - Utilize the Full Functionality of the Whid...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

Utilize the Full Functionality of the Whidbey File Management
By: Benoyraj Baskaran
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 5
    2004-08-17

    Table of Contents:
  • Utilize the Full Functionality of the Whidbey File Management
  • Classes that Supports System.IO.namespace
  • More Classes and Public Methods
  • Public Methods with File Class
  • FileStream and Other Classes
  • IOException Class and Others
  • System.Security.Permissions
  • Mode, Share and Access of Files

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Utilize the Full Functionality of the Whidbey File Management - More Classes and Public Methods


    (Page 3 of 8 )

    Some of the public methods used for Directory class are described as follows.

    • CreateDirectory – Creates a new directory in a specified path.
    • Delete  -  Delete the directory from the specified path
    • Exists – Checks whether the associated directories exists in the specific path
    • GetCreationTime – Get the creation time of directory
    • GetCreationTimeUtc – Get the creation time in universal coordinated time
    • GetCurrentDirectory – Get the current working directory of the application
    • GetDirectories – Gets the name of subdirectories in the working folder
    • GetDirectoryRoot – Get root and volume information for the specified path
    • GetFiles  - Get or returns all the files listed in the specified directory
    • GetFileSytemEntries - Get or returns all the files and sub directories listed in the specified directory
    • GetLastAccessTime – Last access date and time of the specified directory
    • GetLastAccessTimeUtc – Last access date and time of the specified directory in universal coordinator time (UTC) format
    • GetLastWriteTime – Last written date and time of a specified directory
    • GetLastWriteTimeUtc – Last written date and time of a specified directory in universal coordinator time (UTC)
    • GetLogicalDrives – Get all the logical drives on the computer
    • GetParent – Get the absolute and relative path of the parent directory
    • Move – Move the specific directory to another location
    • SetCreationTime – Sets the creation date and time for the specified directory or file
    • SetCreationTimeUtc – Sets the creation date and time for the specified directory or file in universal coordinated time format
    • SetCurrentDirectory – Sets the current directory to a specified directory in an application path
    • SetLastAccessTime - Sets the last access date and time for the specified directory or file

    Usage:

    ‘  Checking whether the directory exists in the specified path

     Dim strMyPath as String = “C:\mySample”

     If Directory.Exists(strMyPath) = True then
           Directory.Delete(strMyPath)
     Else
         Directory.CreateDirectory (strMyPath)
     End if

    5. The class DirectoryInfo used the same functionality as Directory class except if you are not going to reuse an object several times.

    6. The class DirectoryNotFoundException throws exception error when the file or directory  not found in the specified path.

    7. The class EndOfStreamException throws exception error at the past the end of a stream.

    8. The class ErrorEventArgs provides data for Error event.

    Usage:

    ‘  Checking whether the directory exists in the specified path

     Dim strMyPath as String = “C:\mySample”

     ‘ Initializes the “objException” Exception object

     Dim objException as New Exception(“Cannot create Directory”)

     ‘  Creates an ErrorEventArgs with the exception.
     Dim objErrorEventArgs as New ErrorEventArgs(objException)

     If Directory.Exists(strMyPath) = True then
           Directory.Delete(strMyPath)
     Else
         Directory.CreateDirectory (strMyPath)
     End if

     ‘ Retrieves Exception from ErrorEventArgs

     Dim objReturnedException as Exception= objErrorEventArgs.GetException()

     If objReturnedException.Message <> “” then
      MessageBox.Show(objReturnedException.Message
     End if

    End Sub 

    9. The class File provides to manage the file manipulation operations such as Creating, Opening, Deleting, Copying and Moving of files using FileStream objects. File class methods are static.

    More .NET Articles
    More By Benoyraj Baskaran


     

    .NET ARTICLES

    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries
    - Introducing LINQ to SQL Designer using Visua...
    - Beginning LINQ to SQL Using Visual Studio 20...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway