<html>
<head>
<title>File Access Component</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="Description">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">File Access Component</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">


<p><!--<primary>files</primary><secondary>manipulating
from applications</secondary>--> <!--<primary>applications</primary><secondary>file
manipulation capabilities</secondary>--> <!--<primary>File Access
components</primary>-->In addition to the native ASP objects
(Request, Response, etc.) and the various installable components (Ad
Rotator, Browser Capabilities, etc.), you also have access to a third
group of objects. These objects are instantiated directly from the
Microsoft Scripting Runtime DLL (<filename>scrrun.dll </filename>).
This DLL contains functionality that is neither in the native ASP
objects nor in the VBScript runtime
(<filename>vbscript.dll</filename> ) itself. From the scripting DLL,
you can instantiate objects that provide your application with
extensive file-manipulation capabilities. (From this DLL, you also
can create a Dictionary object that provides you with a way to
perform collection-type functions without true collections.)</p>




<p>All file manipulation is performed by the
<!--<primary>FileSystemObject
object</primary>-->FileSystemObject object. Your application
will have only one of these, and it represents your
application's "window" onto the system's file
structures. With this object, you are able to perform some simple
functions such as opening and closing files, but the real strength of
this object is that through it you are able to instantiate the other
file manipulation objects: Drive, Folder, and File. Through these
objects, your application has almost all the power over the file
system that you have through a command-line interface.</p>
</td></tr>
</table>
</div>
<div id="AccessoryFilesRequiredDLLFiles">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Accessory Files/Required DLL Files</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2">&nbsp;</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">




<dl>
<dt><filename>Scrrun.DLL</filename><!--<primary>Scrrun.DLL library</primary>--></dt>
<dd><p>The dynamic link library that contains all the scripting objects.
This DLL is installed by default when you install IIS 4.0 on your web
server.</p></dd>

</dl>
</td>
</tr>
</table>
</div>
<div id="InstantiatingInstallableComponents">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Instantiating Installable Components</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2">&nbsp;</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">




<p><!--<primary>instantiating</primary><secondary>FileSystemObject
object</secondary>--> <!--<primary>FileSystemObject
object</primary><secondary>instantiating</secondary>-->To
create an object variable containing an instance of the
FileSystemObject component, use the CreateObject method of the Server
object. The syntax for the CreateObject method is as follows:</p>




<span class="PROGRAMLISTING"><pre>Set objMyObject = Server.CreateObject(<var class="replaceable">strProgId</var>)</pre></span>




<p>where:</p>




<ul><dd><p><var class="replaceable"> objMyObject</var> represents the name of the
FileSystemObject variable.</p></dd><dd><p><var class="replaceable"> strProgId</var> represents the programmatic
identifier (ProgID) for the FileSystemObject component, which is
<span class="LITERAL">Scripting.FileSystemObject.</span></p></dd></ul>
<sect2 role="" id="ch19-4-fm2xml" label="19.2.1">
<p class="TITLE">Example</p>




<span class="PROGRAMLISTING"><pre>&lt;% 

' The following code uses the CreateObject method of 
' the Server object to instantiate a FileSystemObject.
Dim fsFileSystemObject
Set fsFileSystemObject = _
   Server.CreateObject("Scripting.FileSystemObject")

%&gt;</pre></span>




<p>For more details on the use of the CreateObject method, see its entry
in <link linkend="ch09-1-fm2xml">Chapter 9</link>.</p>
</sect2>
</td>
</tr>
</table>
</div>
<div id="CommentsTroubleshooting">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Comments/Troubleshooting</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2">&nbsp;</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">




<p><!--<primary>comments and
troubleshooting</primary><secondary>File Access
components</secondary>-->The file access components of
<filename>scrrun.dll</filename> are straightforward to use. When
errors occur, the various properties and methods all return error
messages that are in accordance with what you would expect if you
were to perform a given file operation through the command line. For
example, if you attempt to write or read files on the floppy drive on
your computer, but you have no disk in the drive, you will receive a
"disk not ready" error.</p>
</td>
</tr>
</table>
</div>
<div id="AtEndOfLineTextStreamObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">AtEndOfLine (TextStream Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">tsObj</var><span class="LITERAL">.AtEndOfLine</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>A Boolean value that indicates whether the file pointer is at the end
of the current line. This is a read-only property.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The following code instantiates a FileSystemObject and a TextStream
object. It then uses the Read method to read one character at a time
until the end of the line is reached. Notice that the use of the
AtEndOfStream and AtEndOfLine properties are identical.</p>




<span class="PROGRAMLISTING"><pre>&lt;%

' Set up constants.
Const constForReading       = 1 
Const constTristateFalse    = 0

' Dimension local variables. 
Dim fsoObject     ' FileSystemObject
Dim tsObject      ' TextStream Object
Dim strReturned   ' String variable to hold file contents

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the OpenTextFile method of fsoObject,
' create a text file.
Set tsObject = _
    fsoObject.OpenTextFile("d:\docs\test.txt", _
    constForReading, constTristateFalse)

' Read one character at a time until the end of the 
' line has been reached.
Do While Not tsObject.AtEndOfLine
   StrReturned = strReturned &amp; tsObject.Read(1)
Loop
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>If you attempt to use the AtEndOfLine property with a text file
opened for any purpose other than reading, you will receive an error.</p>




<p>The AtEndOfLine property will not inform you that you have reached
the end of the file.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="AtEndOfStreamTextStreamObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
AtEndOfStream (TextStream Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">tsObj</var><span class="LITERAL">.AtEndOfStream</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>A Boolean value that indicates whether you have reached the end of
the current text file. This is a read-only property.</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The following code instantiates a FileSystemObject and a TextStream
object. Then it uses the Read method to read one character at a time
until the end of the file is reached. Notice that the use of the
AtEndOfStream and AtEndOfLine properties are identical.</p>




<span class="PROGRAMLISTING"><pre>&lt;%

' Set up constants.
Const constForReading      = 1 
Const constTristateFalse    = 0

' Dimension local variables. 
Dim fsoObject     ' FileSystemObject
Dim tsObject      ' TextStream Object
Dim strReturned   ' String variable to hold file contents.

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the OpenTextFile method of fsoObject, create 
' a text file.
Set tsObject = _
    fsoObject.OpenTextFile("d:\docs\test.txt", _
    constForReading, constTristateFalse)

' Read one character at a time until the end of the 
' file has been reached
Do While Not tsObject.AtEndOfStream
   StrReturned = strReturned &amp; tsObject.Read(1)
Loop
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>If you attempt to use the AtEndOfStream property with a text file
opened for any purpose other than reading, you will receive an
error.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="AttributesFileObjectFolderObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Attributes (File Object, Folder Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="PROGRAMLISTING"><pre>Normal</pre></span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>An integer containing a combination of values representing various
file system attributes. This property is read-only or read/write
depending on the specific file attribute in question.</p>




<p>The following table lists the values that the Attributes property can
contain. To determine whether a File or Folder object has a
particular value, use the bitwise <span class="LITERAL">And</span> operator to
compare the Attributes property value and the specific constant in
which you're interested. If the result is
<span class="LITERAL">True</span>, then that specific attribute is
<span class="LITERAL">True</span>. See the following examples.</p>




<table border="1">




<thead>
<tr valign="top">
<td>
<p>Attributes Constant</p></td>
<td>
<p>Value</p></td>
<td>
<p>Description</p></td>
</tr>



</thead>



<tbody>
<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>Normal</pre></span></td>
<td>
<p>0</p></td>
<td>
<p>No attributes are set.</p></td>
</tr>



<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>ReadOnly</pre></span></td>
<td>
<p>1</p></td>
<td>
<p>Read-only. This attribute is read/write.</p></td>
</tr>



<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>Hidden</pre></span></td>
<td>
<p>2</p></td>
<td>
<p>Hidden. This attribute is read/write.</p></td>
</tr>



<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>System</pre></span></td>
<td>
<p>4</p></td>
<td>
<p>System file. This attribute is valid only for File objects and is
read/write.</p></td>
</tr>



<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>Volume</pre></span></td>
<td>
<p>8</p></td>
<td>
<p>The drive's volume label. This attribute is read-only.</p></td>
</tr>



<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>Directory</pre></span></td>
<td>
<p>16</p></td>
<td>
<p>Directory. This attribute is read-only.</p></td>
</tr>



<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>Archive</pre></span></td>
<td>
<p>32</p></td>
<td>
<p>Archived. This attribute is read/write.</p></td>
</tr>



<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>Alias</pre></span></td>
<td>
<p>64</p></td>
<td>
<p>A link or shortcut for another file. This attribute is valid only for
File objects and is read-only.</p></td>
</tr>



<tr valign="top">
<td>
<span class="PROGRAMLISTING"><pre>Compressed</pre></span></td>
<td>
<p>128</p></td>
<td>
<p>Compressed. This attribute is valid only for File objects and is
read-only.</p></td>
</tr>



</tbody>

</table>
</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">intNewAttributes</var></dt>
<dd><p>An integer containing the sum of a file's or folder's
attributes. For example, if you wanted to set the Archived and Hidden
attributes to <span class="LITERAL">True</span>,
<var class="replaceable">intNewAttributes</var> would have a value of
<span class="LITERAL">Hidden + Archive</span>, or 34 (2 + 32). When assigned to
the Attributes property, this integer would set these two attributes
to <span class="LITERAL">True</span>.</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The following code uses the Attributes property first with a File
object, and then with a Folder object.</p>




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
Dim filObject   ' File Object
Dim fdrObject   ' Folder Object

' Declare constants.
Const Hidden = 2
Const Archive = 32

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize the 
' File object.
Set filObject = fsoObject.GetFile("d:\docs\test.txt")

' Set the Hidden (value = 2) and Archive (value = 32) 
' attributes for the Test.TXT file.
filObject.Attributes = (Hidden + Archive)

' Using the GetFolder method of fsoObject, initialize 
' the Folder object.
Set fdrObject = fsoObject.GetFolder("d:\docs")

' Determine whether the folder is itself hidden.
If (fdrObject.Attributes And Archive) Then
   ' Folder is hidden.
Else
   ' Folder is NOT hidden.
End If
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>If you attempt to use the read-only attributes that deal only with
File objects with a Folder object, the result is always a
<span class="LITERAL">False</span> value. However, if you attempt to set any of
the read-only attributes for File or Folder objects, the result is an
error.</p>




<p>Note that you must explicitly declare constants for use with the File
Access components.





</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="AvailableSpaceDriveObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
AvailableSpace (Drive Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">drvObj</var><span class="LITERAL">.</span><!--<primary>AvailableSpace property (Drive)</primary>-->
<!--<primary>physical drives</primary><secondary>disk space remaining</secondary>-->
<!--<primary>drives</primary><secondary>disk space remaining</secondary>-->
<!--<primary>disk space on drives</primary>--><span class="LITERAL">AvailableSpace</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The number of bytes of space left on the current drive. It is
inaccurate for drives with over 2GB of available space. This is a
read-only property.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%
' Dimension local variables. 
Dim fsoObject       ' FileSystemObject
Dim drvObject       ' Drive Object
Dim lngAvailBytes   ' Number of bytes available

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetDrive method of fsoObject, initialize a 
' Drive object.
Set drvObject = fsoObject.GetDrive("\\PublicDocs")
' Retrieve the amount of space (in bytes) available 
' on the drive.
lngAvailBytes = drvObject.AvailableSpace
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The only time the value for the AvailableSpace property and the value
for the FreeSpace property will be different is if the drive supports
quotas. For all practical purposes, you can use these two properties
interchangeably.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="DateCreatedFileObjectFolderObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
DateCreated (File Object, Folder Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">Obj</var><span class="LITERAL">.DateCreated</span><!--<primary>DateCreated property</primary>-->
<!--<primary>files</primary><secondary>date created</secondary>-->
<!--<primary>folders</primary><secondary>date created</secondary>-->
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>A date value that represents the date the file or folder was created.
This is a read-only value controlled by the operating system.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject    ' FileSystemObject.
Dim fdrObject    ' Folder object.
Dim datCreated   ' Date variable.

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFolder method of fsoObject, initialize 
' a Folder object
Set fdrObject = fsoObject.GetFolder("c:\Docs")
' Retrieve the date the folder was created.
datCreated = fdrObject.DateCreated
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The value of this property indicates the date the file was created,
<em>not</em> the date the file was written to the current
drive.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="DriveFileObjectFolderObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Drive (File Object, Folder Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">Obj</var><span class="LITERAL">.Drive</span><!--<primary>Drive property</primary>-->
<!--<primary>drives</primary><secondary sortas="particular file system objects">for particular file system objects</secondary>-->
<!--<primary>physical drives</primary><secondary sortas="particular file system objects">for particular file system objects</secondary>-->
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Returns a Drive with which the File or Folder object is associated.
This property is read-only.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject     ' FileSystemObject
Dim filObject     ' File Object
Dim objDrive      ' Drive name

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize 
' a File object.
Set filObject = fsoObject.GetFile("PublicDocs.txt")
' Retrieve the drive name with which the File object 
' is associated.
Set objDrive = filObject.Drive
' Note that this drive is actually the current drive 
' in this case.
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The Drive property can represent either a physical, local, or mapped
drive or a network share.</p>




<p>Because the Drive object's default property is Path, you can
assign the drive name to a string as follows:</p>




<span class="PROGRAMLISTING"><pre>strDrive = filObject.Drive</pre></span>




<p>This is really a shorthand version of:</p>




<span class="PROGRAMLISTING"><pre>strDrive = filObject.Drive.Path</pre></span>




<p>If you wish to manipulate the Drive object, though, you must use the
<span class="LITERAL">Set</span> statement to assign the reference to an object
variable. For example:</p>




<span class="PROGRAMLISTING"><pre>Set objDrive = filObject.Drive</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="FileSystemDriveObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
FileSystem (Drive Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">drvObj</var><span class="LITERAL">.FileSystem</span><!--<primary>FileSystem property (Drive)</primary>-->
<!--<primary>drives</primary><secondary>format type</secondary>-->
<!--<primary>physical drives</primary><secondary>format type</secondary>-->
<!--<primary>format</primary><secondary>physical drives</secondary>-->
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>A string value that represents the file system type used to format
the current drive. The recognized file system types are CDFS, NTFS,
FAT, and FAT32. This is a read-only property.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject      ' FileSystemObject
Dim drvObject      ' Drive Object
Dim strFileSys     ' File system of drive

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetDrive method of fsoObject, initialize 
' a Drive object.
Set drvObject = fsoObject.GetDrive("\\PublicDocs")
' Retrieve the file system for the drive. This value 
' will contain one of the following strings: 
' NTFS, FAT, or CDFS. 
strFileSys = drvObject.FileSystem
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>You can rely on the value of the FileSystem property of a Drive
object to reflect cluster sizes and security features available for
the current drive.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="IsReadyDriveObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
IsReady (Drive Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">drvObj</var><span class="LITERAL">.IsReady</span><!--<primary>IsReady property (Drive)</primary>-->
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>A Boolean value representing whether the current drive is available
for reading or writing. Use this property, for example, to determine
whether a floppy disk or CD has been placed in a drive. This is a
read-only property.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject      ' FileSystemObject
Dim drvObject      ' Drive Object

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject(
                "Scripting.FileSystemObject")
' Using the GetDrive method of fsoObject, initialize a 
' Drive object.
Set drvObject = fsoObject.GetDrive("\\PublicDocs")
' Check to see if the drive is ready.
If drvObject.IsReady Then
   ' Drive is ready for read/write.
Else
   ' Drive is not ready.
End If
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>It is a good idea to use the IsReady property before attempting to do
any drive access. It can be used to determine the readiness of
removable-media drives (floppy and CD-ROM drives) and fixed-media
drives.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="IsRootFolderFolderObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
IsRootFolder (Folder Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">fdr</var><span class="LITERAL">.IsRootFolder</span><!--<primary>IsRootFolder property (Folder)</primary>-->
<!--<primary>folders</primary><secondary>determining if root</secondary>-->
<!--<primary>root folder</primary>-->
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>A Boolean value that allows you to determine if the current folder is
the root folder. This is a read-only property.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject      ' FileSystemObject
Dim fdrObject      ' Folder Object

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFolder method of fsoObject, initialize a 
' File object.
Set fdrObject = fsoObject.GetFolder("PublicDocs.txt")
' Determine whether the current folder is a root folder
' or if it is nested.
If fdrObject.IsRootFolder Then
   ' Folder is located directly off the drive letter 
   ' or share name.
Else
   ' The folder is nested within at least one other 
   ' folder.
End If
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The Microsoft documentation shows how to use this property to
determine to how many levels the current folder is nested. For
convenience, the following code demonstrates this:</p>




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject      ' FileSystemObject
Dim fdrObject      ' Folder Object
Dim intNestedLevel ' Level to which the folder is nested

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFolder method of fsoObject, initialize a 
' File object.
Set fdrObject = fsoObject.GetFolder("PublicDocs.txt")
' Determine whether the current folder is a root folder
' or if it is nested.
If fdrObject.IsRootFolder Then
   ' Folder is located directly off the drive letter or 
   ' share name.
Else
   ' For more on the ParentFolder property of the 
   ' Folder object, see the following.
   Do Until fdrObject.IsRootFolder
      Set fdrObject = fdrObject.ParentFolder
      intNestedLevel = intNestedLevel + 1
   Loop
End If
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="ParentFolderFileObjectFolderObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
ParentFolder (File Object, Folder Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">Obj</var><span class="LITERAL">.ParentFolder</span><!--<primary>ParentFolder object (Folder)</primary>-->
<!--<primary>folders</primary><secondary>parent folders</secondary>-->
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Returns a Folder object representing the folder in which the file or
folder is located. This is a read-only property.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">





<p>The following code demonstrates the use of the ParentFolder property
when used with a File object and then with a Folder object. Note
that, because Name is the default property of a Folder object, the
code in the ASP page appears to treat the value returned by the
ParentFolder property as a string.</p>




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject        ' FileSystemObject
Dim filObject        ' File Object
Dim fdrObject        ' Folder Object
Dim strFileParent    ' Parent folder of file object
Dim strFolderParent  ' Parent folder of folder object

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize the 
' File object.
Set filObject = fsoObject.GetFile("d:\docs\test.txt")

' Retrieve the name of the folder containing the file Test.TXT.
' In this example, the value of strFileParent is "docs".
strFileParent = filObject.ParentFolder
' Using the GetFolder method of fsoObject, initialize 
' the Folder object.
Set fdrObject = fsoObject.GetFolder("d:\mystuff\docs")

' Retrieve the name of the folder that contains the 
' folder "docs". In this example, the value of 
' strFileParent is "mystuff".
strFolderParent = fdrObject.ParentFolder
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>



</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="CloseTextStreamObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">Close (TextStream Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">tsObj</var><span class="LITERAL">.Close</span><!--<primary>Close method</primary><secondary>TextStream object</secondary>-->
<!--<primary>files</primary><secondary>opening/closing</secondary>-->
<!--<primary>closing</primary><secondary>text files</secondary>-->
<!--<primary>TextStream object</primary><secondary>closing</secondary>-->
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Closes a text file that has been opened as a TextStream object.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
Dim tsObject    ' TextStream Object

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the OpenTextFile method of fsoObject, initialize 
' the File object.
Set tsObject = fsoObject.OpenTextFile( _
               "d:\docs\test.txt", ForReading, False)

' Read into the string the contents of the text file.
strContents = tsObject.ReadAll
' Close the open text file.
tsObject.Close
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>You can have only a limited number of open files in your application
(similar to the use of open files in Visual Basic), so it is
important to close all open text files after you are finished with
them.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="CopyFileObjectFolderObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Copy (File Object, Folder Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">obj</var><span class="LITERAL">.Copy</span><!--<primary>Copy method</primary><secondary>File object</secondary>-->
<!--<primary>Copy method</primary><secondary>Folder object</secondary>-->
<!--<primary>files</primary><secondary>copying</secondary>-->
<!--<primary>folders</primary><secondary>copying</secondary>-->
<!--<primary>copying</primary><secondary>files and
folders</secondary>-->
<var class="replaceable">strDestination</var> <span class="LITERAL">[,</span> <var class="replaceable">blnOverWrite</var><span class="LITERAL">]</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Copies a file from one location to another.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">strDestination</var></dt>
<dd><p>A string value that represents the full path of the location to which
you wish to copy the current file.</p></dd>




<dt><var class="replaceable">blnOverWrite</var></dt>
<dd><p>A Boolean value that indicates whether a file of the same name as the
file to be copied will be overwritten. The default is
<span class="LITERAL">True</span>.</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
Dim filObject   ' File Object

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize 
' the File object.
Set filObject = fsoObject.GetFile("d:\docs\test.txt")

' Copy the file to a temporary directory.
filObject.Copy "e:\storage\temp\test_copy.txt", True
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The Copy method performs exactly the same function as the CopyFile
and CopyFolder methods of the FileSystemObject object. However, it is
important to note that the CopyFile and CopyFolder methods will allow
you to copy more than one file or folder at a time.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="CopyFolderFileSystemObjectObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
CopyFolder (FileSystemObject Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">fsoObj</var><span class="LITERAL">.CopyFolder</span><!--<primary>CopyFolder method
(FileSystemObject)</primary>-->
<var class="replaceable">strSource</var>,
<var class="replaceable">strDestination</var> <span class="LITERAL">[,</span> <var class="replaceable">blnOverWrite</var><span class="LITERAL">]</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Allows you to copy a folder and all of its contents from one location
to another.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">strSource</var></dt>
<dd><p>A string value that represents the full path of the location from
which you wish to copy a folder or folders.
<var class="replaceable">strSource</var> can include wildcard characters.</p></dd>




<dt><var class="replaceable">strDestination</var></dt>
<dd><p>A string value that represents the full path of the location to which
you wish to copy the folder or folders designated by
<var class="replaceable">strSource</var>.</p></dd>




<dt><var class="replaceable">blnOverWrite</var></dt>
<dd><p>A Boolean value that indicates whether a file of the same name as the
file to be copied will be overwritten. The default is
<span class="LITERAL">True</span>.</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Use the FileSystemObject object's CopyFolder method
' to copy the Temp directory and all its contents from
' the C drive to the D drive, overwriting if necessary.
fsoObject.CopyFolder "c:\temp", "d:\temp", True
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>If an error is raised when calling CopyFolder, the method stops
immediately and does not reverse any actions already performed.</p>




<p>The CopyFolder method is as fast as copying the folder using the
command line.





</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="CreateFolderFileSystemObjectObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
CreateFolder (FileSystemObject Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">fsoObj</var><span class="LITERAL">.CreateFolder(</span><!--<primary>CreateFolder method (FileSystemObject)</primary>-->
<!--<primary>folders</primary><secondary>creating new</secondary>--><var class="replaceable">strFolderName</var><span class="LITERAL">)</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Creates a folder in a specified location.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">strFolderName</var></dt>
<dd><p>A string value that represents the full physical path of the folder
you want to create</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Create a new directory.
fsoObject.CreateFolder("e:\storage\newdir")
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>If you attempt to create a folder that already exists, an error will
be raised.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="DeleteFileObjectFolderObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Delete (File Object, Folder Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">Obj</var><span class="LITERAL">.Delete</span><!--<primary>Delete method</primary><secondary>File object</secondary>-->
<!--<primary>Delete method</primary><secondary>Folder object</secondary>-->
<!--<primary>files</primary><secondary>deleting</secondary>-->
<!--<primary>folders</primary><secondary>deleting</secondary>-->
<!--<primary>deleting</primary><secondary>files and folders</secondary>--> <var class="replaceable">blnForce</var>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Deletes a file or folder.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">blnForce</var></dt>
<dd><p>A Boolean value that indicates whether to delete files or folders,
even if they are marked as read-only</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
Dim filObject   ' File Object

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize the 
' File object.
Set filObject = fsoObject.GetFile("d:\docs\test.txt")

' Delete the TEST.TXT file--even if the file is marked 
' as read-only.
filObject.Delete True
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The Delete method of the File and Folder objects is functionally the
same as the DeleteFile and DeleteFolder methods of the
FileSystemObject object. If you use the Delete method of a Folder
object, that folder and all of its contents will be deleted. The
method will not warn you if you attempt to delete a directory that
contains files.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="GetBaseNameFileSystemObjectObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
GetBaseName (FileSystemObject Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">fsoObj</var><span class="LITERAL">.GetBaseName(</span><!--<primary>GetBaseName method (FileSystemObject)</primary>-->
<!--<primary>files</primary><secondary>names of</secondary>-->
<!--<primary>names</primary><secondary>files and folders</secondary>--><var class="replaceable">strPath</var><span class="LITERAL">)</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Extracts the name of a file—minus any file extension—from
a full file path.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">strPath</var></dt>
<dd><p>A string representing the full file path of a given file whose base
name you want to retrieve</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetBaseName method, retrieve the base 
' names of several path strings. 
' This example returns "searchstart" as the base name.
Response.Write fsoObject.GetBaseName( _
               "/apps/search/searchstart.asp")
' This example returns "search" as the base name.
Response.Write fsoObject.GetBaseName("/apps/search/")
' This example returns "search" as the base name.
Response.Write fsoObject.GetBaseName("/apps/search")
' This example returns "nofile" as the base name--even
' though the nofile.txt file does not exist.
fsoObject.GetBaseName("/apps/search/nofile.txt")
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>GetBaseName attempts to retrieve the base name for a file from a path
string. If the last element in the path string is a folder, the
folder name is returned—even if you include a closing slash (/)
or backslash (\) character. The path string is not checked for its
validity or its existence as a real path on the server. The method
just looks at the path as a string. For this reason, the association
of this method with the FileSystemObject object is deceiving, since
no file manipulation actually occurs.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="GetParentFolderNameFileSystemObjectObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
GetParentFolderName (FileSystemObject Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">fsoObj</var><span class="LITERAL">.GetFolderName (</span><!--<primary>GetFolderName method (FileSystemObject)</primary>-->
<!--<primary>folders</primary><secondary>names of</secondary>--><var class="replaceable">strPath</var><span class="LITERAL">)</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Determines the name of the last parent folder in a given path string.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">strPath</var></dt>
<dd><p>A string representing the full file path of a given file or folder
whose parent folder name you are attempting to retrieve</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject(
                "Scripting.FileSystemObject")
' Using the GetParentFolderName method, retrieve the 
' parent folder names of several path strings. 
' This example returns "search" as the parent folder
' name.
Response.Write fsoObject.GetParentFolderName( _
               "/apps/search/searchstart.asp")
' This example return "apps" as the parent folder name
Response.Write fsoObject.GetParentFolderName ("/apps/search/")
' This example also returns "apps" as the parent folder 
' name.
Response.Write fsoObject.GetParentFolderName ("/apps/search")
' This example returns "nofile" as the parent folder 
' name--even though nofile.txt does not exist.
Response.Write fsoObject.GetParentFolderName( _
               "/apps/search/nofile.txt")
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Like the GetBaseName method of the FileSystemObject object, the
GetParentFolderName method acts only on the path string itself. The
path string argument is not checked for validity or existence.



</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="GetSpecialFolderFileSystemObjectObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
GetSpecialFolder (FileSystemObject Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">fsoObj</var>.<span class="LITERAL">GetSpecialFolder</span><!--<primary>GetSpecialFolder method (FileSystemObject)</primary>-->
<!--<primary>web servers</primary><secondary>special folders on</secondary>--> <span class="LITERAL">(</span><var class="replaceable">intSpecialFolderType</var><span class="LITERAL">)</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Retrieves the full physical path of a special folder on the web
server.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">intSpecialFolderType</var></dt>
<dd><p>An integer that represents the type of special folder whose full
physical path you wish to retrieve. The possible values for this
parameter are as follows:</p></dd>

</dl>




<table border="1">




<thead>
<tr valign="top">
<td>
<p>Constant</p></td>
<td>
<p>Value</p></td>
<td>
<p>Description</p></td>
</tr>



</thead>



<tbody>
<tr valign="top">
<td>
<p><span class="LITERAL">WindowsFolder</span></p></td>
<td>
<p>0</p></td>
<td>
<p>The <!--<primary>Windows folder</primary>-->
<!--<primary>WinNT folder</primary>-->Windows or
WinNT folder into which your operating system was installed</p></td>
</tr>



<tr valign="top">
<td>
<p><span class="LITERAL">SystemFolder</span></p></td>
<td>
<p>1</p></td>
<td>
<p>The <!--<primary>System folder</primary>-->System
folder into which libraries and device drivers are installed</p></td>
</tr>



<tr valign="top">
<td>
<p><span class="LITERAL">TemporaryFolder</span></p></td>
<td>
<p>2</p></td>
<td>
<p>The <!--<primary>Temp folder</primary>-->Temp folder
as it is declared in the environment variables</p></td>
</tr>



</tbody>

</table>

</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
' Declare file constants.
Const WindowsFolder   = 0
Const SystemFolder    = 1
Const TemporaryFolder = 2

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Use GetSpecialFolder to retrieve the physical path
' for the Windows, System, and Temp directories. 
' This example returns something similar to "C:\WINNT". 
fsoObject.GetSpecialFolder(WindowsFolder)
' This example returns something similar to 
' "C:\WINNT\SYSTEM32". 
fsoObject.GetSpecialFolder(SystemFolder)

' This example returns something similar to 
' "C:\WINNT\TEMP" 
fsoObject.GetSpecialFolder(TemporaryFolder)
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Note that you must explicitly declare constants for use with the file
access components.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="MoveFolderFileSystemObjectObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
MoveFolder (FileSystemObject Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">fsoObj</var><span class="LITERAL">.MoveFolder</span><!--<primary>MoveFolder method (FileSystemObject)</primary>-->
<!--<primary>folders</primary><secondary>moving</secondary>-->
<!--<primary>moving</primary><secondary>files and folders</secondary>-->
<!--<primary>files</primary><secondary>moving</secondary>--> <var class="replaceable">strSourcePath</var>, <var class="replaceable">strDestinationPath</var>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Moves a folder and all its contents from one location to another.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">strSourcePath</var></dt>
<dd><p>A string representing the path to the folder or folders you wish to
move. You can include wildcard characters in the
<var class="replaceable">strSourcePath</var> argument in the last segment
of the path only.</p></dd>




<dt><var class="replaceable">strDestinationPath</var></dt>
<dd><p>A string representing the path to which you wish to move the folders
referenced in the <var class="replaceable">strSourcePath</var> parameter.
The <var class="replaceable">strDestinationPath</var> parameter cannot
contain any wildcard characters.</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the MoveFolder method, move all the folders 
' under C:\APPS to the D: drive.
fsoObject.MoveFolder "C:\APPS\*.*", "D:\"
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>If you attempt to move a folder to a destination that is already a
filename, you will receive an error. If the destination you provide
represents the name of a preexisting folder, you will receive an
error unless the source argument ends with a wildcard or a backslash
(\). In this case, the source folder (or folders) and all its
contents will be moved to the destination folder. For example, the
following code results in an error:</p>




<span class="PROGRAMLISTING"><pre>&lt;%
' Assume FileSystemObject object is instantiated
'already. Also assume that D:\ apps already exists.
fsoObject.MoveFolder "C:\apps", "d:\apps"
%&gt;</pre></span>




<p>whereas the following code would not result in an error:</p>




<span class="PROGRAMLISTING"><pre>&lt;%
' Assume FileSystemObject object is instantiated
' already. Also assume that D:\ apps already exists.
fsoObject.MoveFolder "C:\apps\*.*", "d:\apps"
' This last line create an apps folder in the D:\apps 
' folder (making D:\apps\apps)
%&gt;</pre></span>




<p>Note that if the web server experiences an error when calling
MoveFolder, all actions stop without any rollback of previous
actions. For example, if you attempt to move a series of three
folders with all their contents and an error occurs on the third
folder to be moved, the first two folders remain moved even though
the third is not. You must include your own code to check for which
files and folders were actually moved and which were not.</p>




<p>If you attempt to move folders between volumes, the underlying
operating system must support this, and user security on the web
server must allow for this.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="OpenAsTextStreamFileObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
OpenAsTextStream (File Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">tsObject =</span><var class="replaceable">filObj</var><span class="LITERAL">.OpenAsTextStream [</span><!--<primary>OpenAsTextStream method (File)</primary>-->
<!--<primary>files</primary><secondary>opening/closing</secondary>-->
<!--<primary>opening</primary><secondary>text files</secondary>-->
<!--<primary>TextStream
object</primary><secondary>opening</secondary>--><var class="replaceable">intAccessMode</var><span class="LITERAL">][,</span>
<var class="replaceable">intFormat</var><span class="LITERAL">]</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Opens a file and creates a TextStream object that you can use to read
or modify the text file. The method returns a TextStream object.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">intAccessMode</var></dt>
<dd><p>An integer that indicates the input/output mode in which you wish to
open the text file. Possible values for this parameter are as
follows:</p></dd>

</dl>




<table border="1">




<thead>
<tr valign="top">
<td>
<p>Constant</p></td>
<td>
<p>Value</p></td>
<td>
<p>Description</p></td>
</tr>



</thead>



<tbody>
<tr valign="top">
<td>
<p><span class="LITERAL">ForReading</span></p></td>
<td>
<p>1</p></td>
<td>
<p>The file will be opened as read-only and cannot be modified by the
current TextStream object.</p></td>
</tr>



<tr valign="top">
<td>
<p><span class="LITERAL">ForWriting</span></p></td>
<td>
<p>2</p></td>
<td>
<p>The file will be opened for writing. If the file already exists when
you call the OpenAsTextStream method, the original file is
overwritten.</p></td>
</tr>



<tr valign="top">
<td>
<p><span class="LITERAL">ForAppending</span></p></td>
<td>
<p>8</p></td>
<td>
<p>The file is opened for appending only. You can only add characters to
the end of this file.</p></td>
</tr>



</tbody>

</table>

<dl>
<dt><var class="replaceable">intFormat</var></dt>
<dd><p>An integer that indicates the format of the file to be opened as a
TextStream object. The possible values for this parameter are thought
of as a single tristate value. The file is Unicode, ASCII, or
whichever is the system default. Possible values for this parameter
are:</p></dd>

</dl>




<table border="1">




<thead>
<tr valign="top">
<td>
<p>Constant</p></td>
<td>
<p>Value</p></td>
<td>
<p>Description</p></td>
</tr>



</thead>



<tbody>
<tr valign="top">
<td>
<p><span class="LITERAL">TristateUseDefault</span></p></td>
<td>
<p>-2</p></td>
<td>
<p>The file format will be the same as the default for the web server
(Unicode or ASCII).</p></td>
</tr>



<tr valign="top">
<td>
<p><span class="LITERAL">TristateTrue</span></p></td>
<td>
<p>-1</p></td>
<td>
<p>The file format will be Unicode.</p></td>
</tr>



<tr valign="top">
<td>
<p><span class="LITERAL">TristateFalse</span></p></td>
<td>
<p>0</p></td>
<td>
<p>The file format will be ASCII.</p></td>
</tr>



</tbody>

</table>

</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
Dim filObject   ' File Object
Dim tsObject    ' TextStream object

' Declare File Access constants.
Const ForAppending = 8
Const TristateTrue = -1

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize the 
' File object. 
Set filObject = fsoObject.GetFile("d:\docs\test.txt")

' Use the OpenAsTextStream method to open the file for 
' appending and in Unicode format.
Set tsObject = filObject.OpenAsTextStream(ForAppending, TristateTrue)
%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The OpenAsTextStream method is virtually equivalent to the
OpenTextFile method of the FileSystemObject object. The only
difference is that the OpenAsTextStream method also can be used to
create a new text file if one does not already exist.</p>




<p>Note that you must explicitly declare constants for use with the File
Access components.







</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="ReadLineTextStreamObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
ReadLine (TextStream Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">tsObj</var><span class="LITERAL">.ReadLine</span><!--<primary>Read method</primary><secondary>TextStream object</secondary>-->
<!--<primary>ReadLine method (TextStream)</primary>-->
<!--<primary>reading</primary><secondary>text files</secondary>-->
<!--<primary>files</primary><secondary>reading from/writing to</secondary>-->
<!--<primary>TextStream object</primary><secondary>reading from/writing to</secondary>--> 
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>The ReadLine method is similar to the Read method of the TextStream
object in that it allows you to read from a text file into a string
variable or compare the results of such a read to another entity.
However, unlike the Read method, which uses an argument to determine
how many characters to read, the ReadLine method reads all characters
from the current pointer location to the next newline character.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>None</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
Dim filObject   ' File Object
Dim tsObject    ' TextStream object
Dim strBuffer   ' Holding buffer

' Declare file access constants.
Const ForReading = 1
Const TristateFalse = 0

' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize the 
' File object.
Set filObject = fsoObject.GetFile("d:\docs\test.txt")

' Use the OpenAsTextStream method to open the file for 
' reading and in ASCII format.
Set tsObject = filObject.OpenAsTextStream(ForReading, TristateFalse)
' Use the ReadLine method to read the next line of text
' from the text file into the strBuffer variable.
strBuffer = tsObject.ReadLine
%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>After calling the ReadLine method, the current location of the
pointer within the file is the character immediately after the last
newline character or at the end of file marker.</p>




<p>Note that you must explicitly declare constants for use with the File
Access components.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="WriteTextStreamObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Write (TextStream Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">tsObj</var><span class="LITERAL">.Write(</span><var class="replaceable">strWriteString</var><span class="LITERAL">)</span><!--<primary>Write method</primary><secondary>TextStream object</secondary>-->
<!--<primary>writing</primary><secondary sortas="text files">to text files</secondary>-->
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Writes a specified string to an open text file at the current
location of the file pointer.</p>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Parameters</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt><var class="replaceable">strWriteString</var></dt>
<dd><p>A string that represents the text you wish to write to the open file</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
Dim filObject   ' File Object
Dim tsObject    ' TextStream object
Dim strEnding
' Declare file access constants.
Const ForAppending = 8
Const TristateFalse = 0

' Initialize string variable. This string will be 
' written to the end of the file opened next.
strEnding = "This is the end, my only friend, the end..."
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize the
' File object.
Set filObject = fsoObject.GetFile("d:\docs\test.txt")

' Use the OpenAsTextStream method to open the file for 
' appending and in Unicode format.
Set tsObject = filObject.OpenAsTextStream(ForAppending, TristateFalse)
' Write a short string to the end of the opened file.
tsObject.Write strEnding
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>The Write method does not place any characters at the beginning or
end of each written string. For this reason, if you use the Write
method to add to a file, make sure that you include any desired
characters (like spaces or newline characters) at the beginning or
end of the strings you write to the file.</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="WriteLineTextStreamObject">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
WriteLine (TextStream Object)</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><var class="replaceable">tsObj</var><span class="LITERAL">.WriteLine([</span><var class="replaceable">strWriteString</var><span class="LITERAL">])</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Writes a string's value into an open file at the location of
the pointer within the file. This method also writes a newline
character to the end of the added string. Otherwise, it is exactly
the same as the Write method.</p>




<dl>
<dt><var class="replaceable">strWriteString</var></dt>
<dd><p>A string that represents the text you wish to write to the open text
file</p></dd>

</dl>




</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Example</td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%

' Dimension local variables. 
Dim fsoObject   ' FileSystemObject
Dim filObject   ' File Object
Dim tsObject    ' TextStream object
Dim strEnding
' Declare file access constants.
Const ForAppending = 8
Const TristateFalse = 0

' Initialize a string variable that will be written to 
' the end of the file opened next.
strEnding = "This is the end, my only friend, the end..."
' Instantiate the FileSystemObject variable.
Set fsoObject = Server.CreateObject( _
                "Scripting.FileSystemObject")
' Using the GetFile method of fsoObject, initialize the 
' File object.
Set filObject = fsoObject.GetFile("d:\docs\test.txt")

' Use the OpenAsTextStream method to open the file for 
' appending and in Unicode format.
Set tsObject = filObject.OpenAsTextStream(ForAppending, TristateFalse)
' Write a short string plus a newline character to the
' end of the opened file.
tsObject.WriteLine strEnding
<lineannotation>. . . [additional code]</lineannotation>

%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">Notes</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>After
calling the WriteLine method, the file   pointer will point to the character
located immediately after the newline character added to the
file.

</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
</body>
</html>