The wonders of the File System Object
August 14, 2000
|
The file system object (FSO) is a wonderful
tool that few web developers know about. You can do nearly anything
with the FSO, from making databases, message boards, to content management.
The FSO is an essential block in an
ASP developer's foundation. We'll
discuss the basic operations of the FSO here, along with some examples
on creating a guestbook, and some more complex features.
|
Introduction
The file system object (FSO) model provides a collection of very handy objects for
accessing a computer's file system. What does this mean? It means
that you can manipulate files, folders, drives, etc., all through
ASP pages. You can write or delete text, store information, move files
around, and perform searches.
|
NOTE:
The computer file system that we'll be manipulating is
the web server's. So make sure you have the appropriate
privileges and information (i.e., so you don't upset your
ISP). Ideally, you'll have a web server set up on your own
computer so you can test and play. If you're running on the
Windows platform and don't have a server set up,
try Microsoft's free Personal Web Server.
|
|
FSO Model Objects |
|
Drive Object |
Provides access to a disk or
network drive |
|
FileSystemObject Object |
Provides access to a computer's file
system |
|
Folder Object |
Provides access to all properties of a
folder |
|
TextStream Object |
Provides an easy way to access a file's
contents |
You can use the above objects to do nearly anything on a computer,
including wreak havoc - so be careful how you play with the FSO.
In a web environment, it can be very important to store information,
such as user info, log files, etc. The FSO provides a powerful
and easy way to store your data in an efficient manner. In this article,
we'll be mainly concentrating on the FileSystemObject
and TextStream Objects.
|
NOTE:
The FSO is provided by Microsoft, and as such, the results
for its use on non-Microsoft operating systems are questionable
in the least. For non Windows OSes, you probably wouldn't
be using active server pages anyway, but I still wouldn't
recommend trying the FSO.
|
Contents:
How do I use the FSO?
Writing Files
Reading Files
Permissions
Searching with the FSO
Content Management with the FSO
What you can't do
Conclusion
The wonders of the File System Object
How do I use the FSO?
|