Sideway
output.to from Sideway
Draft for Information Only

Content

FileSystemObject Object
FileSystemObject.CopyFolder
   Syntax:
   Parameters:
   Remarks:
   Examples:
FileSystemObject.CreateFolder Method
   Syntax:
   Parameters:
   Return Values:
   Remarks:
   Examples:
FileSystemObject.DeleteFolder Method
   Syntax:
   Parameters:
   Remarks:
   Examples:

FileSystemObject Object

One function of FileSystemObject object is the manipulation of folders of the file system.

FileSystemObject.CopyFolder

FileSystemObject.CopyFolder method is the method to copy a folder from the source location to the destination location recursively.

Syntax:

FileSystemObjectName.CopyFolder(source,destination[, overwrite])

 Or in VBScript. Imply

FileSystemObjectName.CopyFolder(source,destination[, overwrite])

 Or in JScript. Imply

FileSystemObjectName.CopyFolder(source,destination[, overwrite])

Parameters:

FileSystemObjectName

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

source

The parameter "source" is used to specify the path string of the source folder specification to be copied from. Wildcard characters can be used to specify one or more folders to be copied. However the wildcard characters can only be used in the last path component of the path specification.

destination

The parameter "destination" is used to specify the path string of the destination folder specification to which the folder and subfolders from source are to be copied. Wildcard characters cannot be used to specify the path of  desitination folder.

overwrite

The optional parameter "overwrite" is a boolean value used to indicate that existing folders in destination are to be overwritten are not. The default value of parameter overwrite is true. Folders are overwritten if the boolean value is true. Folders are not overwritten if the boolean value is false.

Remarks:

FileSystemObjectName should always refer to a FileSystemObject Object.

If the parameter source contains wildcard characters or the parameter destination ends with a path separator (\), the parameter destination is assumed to be an existing folder in which to copy matching folders and subfolders. Otherwise, the parameter destination is assumed to be the name of the folder to be created for copying to.

In either case, when copying from the source to the desination,

  • If the destination does not exist, the source folder and all its contents gets copied.

  • If the destination is an existing file, an error occurs.

  • If the destination is a directory, an attempt is made to copy the folder and all its contents. If a file contained in source already exists in destination, an error occurs if overwrite is false. Otherwise, source file will copy to destination and the existing file is overwritten when overwrite is true.

  • If destination is a read-only directory, an error occurs if an attempt is made to copy an existing read-oly file into that directory and overwrite is false.

An error also occurs if a source doesnot match any folders when using wildcard characters.

Besides, the CopyFolder method stops on the first error it encounters. No attempt is made to roll back any changes were made before an error occurs.

Examples:

  • Example of using the CopyFolder method to copy contents

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.CopyFolder "c:\temp1\*", "c\temp2\" 
    </script>

    HTML web page ouput:

     

  • Example of using the CopyFolder method to copy contents

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    fso.CopyFolder("c:\\temp1\\*", "c\temp2\\");
    </script>

    HTML web page ouput:

     

FileSystemObject.CreateFolder Method

FileSystemObject.CreateFolder method is the method to create a folder according to the specified foldername and return an instance of Folder object cooresponding to the created folder related to the specified FileSystemObject Object

Syntax:

FileSystemObjectName.CreateFolder(foldername)

 Or in VBScript. Imply

Set folderobjectname = FileSystemObjectName.CreateFolder(foldername)

 Or in JScript. Imply

folderobjectname = FileSystemObjectName.CreateFolder(foldername) 

Parameters:

folderobjectname

The parameter "folderobjectname" is the name assigned to an instance of Folder object created and returned by the method using the FileSystemObjectName.CreateFolder Method.

FileSystemObjectName

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

foldername

The parameter "foldername" is used to specify the path specification used to indentify the folder to be created and the instance of Folder object of the corresponding folder to be returned.

Return Values:

Folder object

The method returns a Folder object corresponding to the specified foldername related to the specified FileSystemObject Object. .

Remarks:

FileSystemObjectName Method should always refer to a FileSystemObject Object.

An error occurs if the specified folder already exists.

Examples:

  • Example of using the CreateFolder method to create a folder and return an instance of Folder object accordingly.

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso, foldero
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set foldero = fso.CreateFolder("c:\temp")
    Response.Write foldero.Path  & "<br />"
    </script>

    HTML web page ouput:

    C:\temp

  • Example of using the CreateFolder method to create a folder and return an instance of Folder object accordingly

    ASP JScript command::

    <script runat="server" language="JScript">
    var fso, foldero;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    foldero = fso.CreateFolder("c:\\temp");
    Response.Write(foldero.Path + "<br />");
    </script>

    HTML web page ouput::

    C:\temp

FileSystemObject.DeleteFolder Method

FileSystemObject.DeleteFolder method is the method to delete the specified folder and its contents related to the specified FileSystemObject Object.

Syntax:

FileSystemObjectName.DeleteFolder(folderspec[, force])

 Or in VBScript. Imply

FileSystemObjectName.DeleteFolder(folderspec[, force])

 Or in JScript. Imply

FileSystemObjectName.DeleteFolder(folderspec[, force])

Parameters:

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 folder specification to be deleted. The parameter folderspec can contain wildcard characters in the last path component.

force

The optional parameter "force" is a boolean value used to indicate that folders with read-only attribute setting are to be deleted or not. The default value of parameter force is false. Folders are deleted if the boolean value is true. Folders are not deleted if the boolean value is false.

Remarks:

FileSystemObjectName should always refer to a FileSystemObject Object.

An error occurs if no matching folders are found.

The DeleteFolder method does not check whether the folders have contents or not. And the specified folder is deleted regardless of whether the folders have contents or not.

Besides, the DeleteFolder method stops on the first error it encounters. No attempt is made to roll back or undo  any changes were made before an error occurs.

Examples:

  • Example of using the DeleteFolder method to delete the specified Folder and its contents

    ASP VBScript command:

    <script runat="server" language="VBScript">
    Dim fso
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.DeleteFolder("c:\temp3")
    </script>

    HTML web page ouput:

     

  • Example of using the DeleteFolder method to delete the specified Folder and its contents

    ASP JScript command:

    <script runat="server" language="JScript">
    var fso;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    fso.DeleteFolder("c:\\temp3")
    </script>

    HTML web page ouput:

     


©sideway

ID: 130300026 Last Updated: 3/21/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

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