This article is first of a series of articles about working with drives, folders and files using ASP. In this article we'll learn how to get hold of Drives collection which FileSystemObject provides us, then we'll use this handle to display a list of all drives connected to our computer with their detailed info. These drives may be fixed hard disks, removable drives like floppy drives, CD-ROM drives or even network drives. We'll then use the handle to a drive to access root folder for that drive and then display all the sub folders and files in that drive. We'll build our application in such a way that we can move around different drives and folders and read different files.
The File Access Component of ASP allows you to manipulate files on your server using ASP code. The first thing you should understand is what objects are available, and what their properties are. They are Drive, File, FileSystem, and Folder. There is also a Drives collection, a Files collection, and a Folders collection. Finally, the Textstream object is useful for moving data to and from files. Current specs for these objects are available from Microsoft's web site; you can click here to see a pop-up window with a relatively complete listing of the objects and their properties and methods.
Setting up a simple file downloading system with VBScript and ASP is no sweat. This system can be tested by downloading a classic ASP app
The primary use for a system like this is to allow downloading of any TEXT based file that would normally be served via a client's browser and be unable to be downloaded. This system works great when setting up downloads for files with the following extensions: *.txt, *.htm, *.html or *.asp . This system won't work to serve binary files such as images.
A secondary use is to allow download access to directories outside the public server space or a hidden directory within the website. This system can also be used in conjunction with the fileupload class to let users
ASP does not allow you to use IO system to modify on files and folders. But with the help of FileSystem object you can delete any file on your server. Do not forget to double check permissions for this operation.
Joining mailing list will entitle you
to receive occasional emails informing you of news and
updates to the site and any special offers that may be
of interest to you.