Working with the Server's file system using ASP.NET

73787 Users read it.
by Kevin Marshall
This tutorial explains how to carry out many common tasks relating to the accessing and manipulating a server file system, including listing files and directories, checking for the existence of a specific file or directory, reading and writing text to text files, copying, moving and deleting files and directories. You will also be shown how to obtain statistics of directories and files such as file size and modified dates. By the time you have worked through this article you will be more knowledgeable about file system access and manipulation using the powerful classes provided within the .NET Framework.

The tutorial covers the following subjects:

  • Writing text to a file
  • Reading text from a file
  • Finding out if a file or directory exists
  • Renaming a file or directory
  • Copying and moving a file or directory
  • Deleting a file or directory
  • Listing the contents of a directory
  • A hierarchal listing example
  • Common problems and errors

We end the tutorial with an example of displaying the contents of a directory using a recursive routine to show the hierarchy of its contents in much the same manner as a tree control would display them.

User Rating (47 votes)
0 reviews available
$3.39 USD

User Level:Beginner
Product:Visual Studio.NET, Web Matrix, CSharp Editor, Dreamweaver MX, Borland C#
Technologies:.NET
Number Of Pages:17

Table of Content:

  • Common problems and errors 
  • About the .NET file classes
  • Creating and writing text to a file
  • Write text to an existing file
  • Read text from a file
  • Find out if a file or directory exists
  • Rename a file or directory
  • Moving a file or directory
  • Copying a file
  • Delete a file or directory
  • Get file or directory statistics
  • List the contents of a directory
  • A hierarchal listing example
Follow us on twitter Subscribe to our RSS feed
Activate your free membership today | Login | Currency