Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


How do I use the FSO?

August 14, 2000

To be able to use the FSO to perform all your dirty work, you must first create the object. If you're familiar with creating objects in ASP pages, then this next line should be no surprise:


<%

Set fso = Server.CreateObject("Scripting.FileSystemObject")

%>

We create the FSO here and set the reference to the variable fso. We can now use the familiar object.method syntax to perform file system manipulations. (Check out the Visual Basic documentation to learn more about objects and object oriented programming.) In this case, we can use fso.method or fso. property, as we'll see in upcoming examples.

NOTE: The FSO model is located in the scripting runtime dll provided by Microsoft, scrrun.dll. You can reference this dll in any application that can reference objects, such as MS Access, Word, and a whole slew of others. This means you're not restricted to just using the FSO in an ASP page.

Here is an abridged list of methods available to the FSO that we will use here to manipulate files:

File Methods
CopyFile Copies one or more files from one place to another
CreateTextFile Creates a file and returns a TextStream object
DeleteFile Deletes a file
OpenTextFile Opens a file and returns a TextStream object that can be used to read from or append to the file

For a complete list of all the methods and properties of the FSO, check out the Microsoft MSDN reference. Let's move onto some examples.

The wonders of the File System Object
The wonders of the File System Object
Writing Files


Up to => Home / Authoring / ASP / FSO




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers