Sideway
output.to from Sideway
Draft for Information Only

Content

FileSystemObject Object
FileSystemObject.GetSpecialFolder Method
   Syntax:
   Parameters:
   Return Values:
   Remarks:
   Examples:
FileSystemObject.Drives Collection
   Syntax:
   Parameters:
   Return Values:
   Remarks:
   Properties of Collection for VBScript:
   Methods of Enumerator for JScript:
   Remarks:
   Examples:
 Drives.Count Property (VBScript)
   Syntax:
   Parameters:
   Return Values:
 Drives.Item Property (VBScript)
   Syntax:
   Parameters:
   Return Values:
   Examples:
 DrivesEnum.atEnd Method
   Syntax:
   Parameters:
   Return Values:
 DrivesEnum.item Method
   Syntax:
   Parameters:
   Return Values:
 DrivesEnum.moveFirst Method
   Syntax:
   Parameters:
   Remarks:
 DrivesEnum.moveNext Method
   Syntax:
   Parameters:
   Remarks:
   Examples:

FileSystemObject Object

One function of FileSystemObject object is the manipulation of general file system information. One type of the file system manipulation is related to the local system. The other type of the file system manipulation is related to the path string editing and the path string need not be an existing path.

FileSystemObject.GetSpecialFolder Method

FileSystemObject.GetSpecialFolder method is the method to return an instance of a Folder object corresponding to the specified special folder specification related to the specified FileSystemObject Object..

Syntax:

FileSystemObjectName.GetSpecialFolder(folderspec)

 Or in VBScript. Imply

Set FolderObjectName = FileSystemObjectName.GetSpecialFolder(folderspec)

 Or in JScript. Imply

FolderObjectName = FileSystemObjectName.GetSpecialFolder(folderspec)

Parameters:

FolderObjectName

The parameter "FolderObjectName" is the name assigned to the instance of the Folder object created by the method using the FileSystemObjectName.GetSpecialFolder Method.

FileSystemObjectName

The parameter "FileSystemObjectName" is used to specify the name of the instance of the FileSystemObject Object related to.

folderspec

The parameter "folderspec" is used to specify  the name of the special folder to be returned. The value of parameter "folderspec" can be

Constant Value Description
WindowsFolder 0 The "WindowsFolder" contains files installed by the Windows operating system.
SystemFolder 1 The "System Folder" contains files of libraries, fonts, and device drivers, installed by the Windows operating system.
TemporaryFolder 2 The "Temporary Folder" contains temporary files stored by the Windows operating system, The path can be found in the TMP environment variable.

Return Values:

Folder object

The method returns a Folder object of the special system folder corresponding to the specified folderspec related to the specified FileSystemObject Object. 

Remarks:

FileSystemObjectName should always refer to a FileSystemObject Object

Examples:

  • Example of using the GetSpecialFolder method to create an instance of "TemporaryFolder" object

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, tfoldero
    Const TemporaryFolder = 2
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set tfoldero = fso.GetSpecialFolder(TemporaryFolder)
    response.write tfoldero.name </script>

    HTML web page ouput:

    Temp

  • Example of using the GetSpecialFolder method to create an instance of "TemporaryFolder" object

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, tfoldero, TemporaryFolder = 2;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    tfoldero = fso.GetSpecialFolder(TemporaryFolder);
    Response.Write(tfoldero.name);
    </script>

    HTML web page ouput:

    Temp

FileSystemObject.Drives Collection

FileSystemObject.Drives Collection is used to return the collection of all Drive objects available on the file system of the local machine related to  the specified FileSystemObject Object.

Syntax:

FileSystemObjectName.Drives

 Or in VBScript. Imply

Set DrivesCollectionName = FileSystemObjectName.Drives

 Or in JScript. Imply

DrivesCollectionName = new Enumerator(FileSystemObjectName.Drives)

Parameters:

DrivesCollectionName

The parameter "DrivesCollectionName" is the name assigned to the instance of the Drives collection returned by the Collection Property using the FileSystemObjectName.Drives Property.

FileSystemObjectName

The parameter "FileSystemObjectName" is used to specify the name of the instance of the FileSystemObject Object related to.

Return Values:

Drives collection

The property returns a Collection of all available Drive objects related to the specified FileSystemObject Object. 

Remarks:

FileSystemObjectName should always refer to a FileSystemObject Object.

Properties of Collection for VBScript:

Property Description
Count a read only property to return the number of items in the Drives collection.
Item to return an item corresponding to the specified key.

Methods of Enumerator for JScript:

Method Description
atEnd to check whether the enumerator is at the end of the collection
Item to return the current item of the Drive object in the enumerator of the Drives collection.
moveFirst> moveFirst to reset the location of current item in the enumerator of the collection to the first item in the enumerator of the collection
moveNext to move the location of current item in the enumerator of the collection to the next item in the enumerator of the collection

Remarks:

FileSystemObjectName should always refer to a FileSystemObject Object.

The term "Drive" under the FSO model can be a hard disk, a CD-Rom drive, a RAM disk or logically connected network Drive etc.

For removable-media drives, the media is not necessary to be inserted into the removable-media drives before these removable-media drives can be appeared in the Drives collection.

For JScript, the Collection is packed as an Enumerator at which Count property is not supported. And the supported properties are atEnd() method, item method, moveFirst method, and moveNext Method.

Examples:

  • Example of using the Drives property to return an collection of all "Drive" objects available

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, drivesc
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set drivesc = fso.Drives
    Response.Write drivesc.Count
    </script>

    HTML web page ouput:

    3

  • Example of using the Drives property to return an collection of all "Drive" objects available

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, drivese;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    drivese = new Enumerator(fso.Drives);
    </script>

    HTML web page ouput:

     

Drives.Count Property (VBScript)

Drives.Count Property of FileSystemObject.Drives Collection is a read only property used to return the number of drive objects in the specified FileSystemObject.Drives collection  related to the specified FileSystemObject object. 

Syntax:

DrivesCollectionName.Count

 Or in VBScript. Imply

 DrivesCollectionName.Count

Parameters:

FileSystemObjectName

The parameter "DrivesCollectionName" is used to specify the name of the instance of the Drives Collection related to.

Return Values:

Number of Drive Objects

The property returns the number of drive objects included in the specified Drives Collections.

Drives.Item Property (VBScript)

Drives.Item Property of FileSystemObject.Drives Collection is used to return a Drive object in the FileSystemObject.Drives collection corresponding to the specified key in the specified FileSystemObject.Drives collection related to the specified FileSystemObject object.

Syntax:

DrivesCollectionName.Item(key)

 Or in VBScript. Imply

 DrivesCollectionName.Item(key)

Parameters:

FileSystemObjectName

The parameter "DrivesCollectionName" is used to specify the name of the instance of the Drives Collection related to.

Return Values:

 Drive Object

The property returns a drive object corresponding to the specified key in the specified Drives Collection. 

Examples:

  • Example of using the Drives property to return the Count and Item properties an collection of all "Drive" objects available

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set drivesc = fso.Drives
    Response.Write drives.count & "<br>"
    For Each driveo in drivesc
    Response.Write driveo.DriveLetter & " drive ready: " & driveo.IsReady &"<br>"
    Next
    Response.Write "<br>"
    Response.Write "E drive ready: " & drivesc.item("E").IsReady
    </script>

    HTML web page ouput:

    3
    C drive ready: True
    D drive ready: True
    E drive ready: False

    E drive ready: False

DrivesEnum.atEnd Method

DrivesEnum.atEnd Method of the Enumerator of FileSystemObject.Drives Collection is used to check whether the enumerator is at the end of the colloection and returns a Boolean true value to indicate the Enumerator is at the end of the enumerator of the specified FileSystemObject.Drives collection related to the specified FileSystemObject object. 

Syntax:

DrivesEnumName.atEnd

 Or in JScript. Imply

DrivesEnumName.atEnd

Parameters:

DrivesEnumName

The parameter "DrivesEnumName" is used to specify the name of the instance of the Drives Enumerator related to.

Return Values:

Boolean

The method returns a Boolean true value to indicate the specified enumerator is at the end of the enumerator of the specified FileSystemObject.Drives collection. A Boolean false value indicates that  the specified enumerator is not  at the end of the enumerator or the enumerator of the collection is empty.

DrivesEnum.item Method

DrivesEnum.item Method of the Enumerator of FileSystemObject.Drives Collection is used to return the current item of the Drive object in the specified enumerator of the Drives collection corresponding to the specified FileSystemObject.Drives Collection related to the specified FileSystemObject object.

Syntax:

DrivesEnumName.item

 Or in JScript. Imply

 DrivesEnumName.item

Parameters:

DrivesEnumName

The parameter "DrivesEnumName" is used to specify the name of the instance of the Drives Enumerator related to.

Return Values:

Drive object

The method returns the current item of the Drive object in the specified enumerator of the Drives collection corresponding to the specified FileSystemObject.Drives Collection related to the specified FileSystemObject object. The return values is "undefined" if the enumerator of the collection is empty or the current item is undefined.

DrivesEnum.moveFirst Method

DrivesEnum.moveFirst Method of the Enumerator of FileSystemObject.Drives Collection is used to reset the location of the current item of the Drive object to the first item in the specified enumerator of the Drives collection corresponding to the specified FileSystemObject.Drives Collection related to the specified FileSystemObject object.

Syntax:

DrivesEnumName.moveFirst

 Or in JScript. Imply

 DrivesEnumName.moveFirst

Parameters:

DrivesEnumName

The parameter "DrivesEnumName" is used to specify the name of the instance of the Drives Enumerator related to.

Remarks:

The method reset the location of the current item of the specified enumerator to the first item of the specified enumerator of the Drives collection corresponding to the specified FileSystemObject.Drives Collection related to the specified FileSystemObject object. If there is no item in the collection, the current item is set to undefined.

DrivesEnum.moveNext Method

DrivesEnum.moveNext Method of the Enumerator of FileSystemObject.Drives Collection is used to move the location of the current item of the Drive object to the next item in the specified enumerator of the Drives collection corresponding to the specified FileSystemObject.Drives Collection related to the specified FileSystemObject object.

Syntax:

DrivesEnumName.moveNext

 Or in JScript. Imply

 DrivesEnumName.moveNext

Parameters:

DrivesEnumName

The parameter "DrivesEnumName" is used to specify the name of the instance of the Drives Enumerator related to.

Remarks:

The method movet the location of the current item of the specified enumerator to the next item of the specified enumerator of the Drives collection corresponding to the specified FileSystemObject.Drives Collection related to the specified FileSystemObject object. If there is no item or no more item in the collection, the current item is set to undefined.

Examples:

  • Example of using methods of the Enumerator of  a Drives collection to return the Drive properties of  an collection of all "Drive" objects available

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso, drivese;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    drivese = new Enumerator(fso.Drives);
    for (; !drivese.atEnd(); drivese.moveNext()) {
    driveo = drivese.item();
    drivese.moveNext;
    Response.Write(driveo.DriveLetter + " drive ready: " +  driveo.IsReady +"<br>")
    }
    drivese.moveFirst(); drivese.moveNext(); drivese.moveNext();
    Response.Write("E drive ready: " + drivese.item().IsReady)
    </script>

    HTML web page ouput:

    C drive ready: True
    D drive ready: True
    E drive ready: False

    E drive ready: False


©sideway

ID: 130300020 Last Updated: 3/18/2013 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019