Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=180500025

Script, Scripting Language, VBScript elements, Server-Side VBScript Object Element FileSystemObject Method

VBScript Methods of FSO Object

Some typical predefined Elements are.

  • FSO Object:
    • BuildPath Method
    • CopyFile Method
    • CopyFolder Method
    • CreateFolder Method ≡ Folder Object
    • CreateTextFile Method
    • DeleteFile Method
    • DeleteFolder Method
    • DriveExists Method
    • FileExists Method
    • FolderExists Method
    • GetAbsolutePathName Method
    • GetBaseName Method
    • GetDrive Method ≡ Drive Object
    • GetDriveName Method
    • GetExtensionName Method
    • GetFile Method ≡ File Object
    • GetFileVersion Method
    • GetFileName Method
    • GetFolder Method ≡ Folder object
    • GetParentFolderName Method
    • GetSpecialFolder Method ≡ Folder object
    • GetStandardStream Method ≡ TextStream object
    • GetTempName Method
    • MoveFile Method
    • MoveFolder Method
    • OpenTextFile Method

MoveFile Method

last updated 12/14/2017

is to move one or more given source files to the specified destination.

Syntax

fsoobjvar.MoveFile ( source, destination )

Argument

fsoobjvarRequired. to specify the associated Object instance reference.MoveFileRequired Keyword. to specify the Method of associated Object.sourceRequired. The path to the file or files to be moved. The source argument string can contain wildcard characters in the last path component only.destinationRequired. The path where the file or files are to be moved. The destination argument can't contain wildcard characters.

Remarks

  • If source contains wildcards or destination ends with a path separator (\), it is assumed that destination specifies an existing folder in which to move the matching files. Otherwise, destination is assumed to be the name of a destination file to create.
  • In either case, three things can happen when an individual file is moved:
  • If destination does not exist, the file gets moved. This is the usual case.
  • If destination is an existing file, an error occurs.
  • If destination is a directory, an error occurs.
  • An error also occurs if a wildcard character that is used in source doesn't match any files.
  • The MoveFile method stops on the first error it encounters. No attempt is made to roll back any changes made before the error occurs.
  • This method allows moving files between volumes only if supported by the operating system.

Applied to

FileSystemObject Object

MoveFolder Method

last updated 12/14/2017

is to move one or more given source folders to the specified destination.

Syntax

fsoobjvar.MoveFolder ( source, destination )

Argument

fsoobjvarRequired. to specify the associated Object instance reference.MoveFolderRequired Keyword. to specify the Method of associated Object.sourceRequired. The path to the folder or folders to be moved. The source argument string can contain wildcard characters in the last path component only.destinationRequired. The path where the folder or folders are to be moved. The destination argument can't contain wildcard characters.

Remarks

  • If source contains wildcards or destination ends with a path separator (\), it is assumed that destination specifies an existing folder in which to move the matching files. Otherwise, destination is assumed to be the name of a destination folder to create.
  • In either case, three things can happen when an individual folder is moved:
  • If destination does not exist, the folder gets moved. This is the usual case.
  • If destination is an existing file, an error occurs.
  • If destination is a directory, an error occurs.
  • An error also occurs if a wildcard character that is used in source doesn't match any folders. The MoveFolder method stops on the first error it encounters. No attempt is made to roll back any changes made before the error occurs.
  • Important This method allows moving folders between volumes only if supported by the operating system.

Applied to

FileSystemObject Object

OpenTextFile Method

last updated 12/14/2017

is to open a given filename file of the associated FileSystemObject Object according to the specified optional iomode setting, create keyword, and format setting, and to return a TextStream Object that can be used to read from, write to, or append to the file.

Syntax

fsoobjvar.OpenTextFile(filename[, iomode[, create[, format]]])

Argument

fsoobjvarRequired. to specify the associated Object instance reference.OpenTextFileRequired Keyword. to specify the Method of associated Object.filenameRequired. String expression that identifies the file to open.iomodeOptional Setting. Can be one of three constants: ForReading, ForWriting, or ForAppending.createOptional. Boolean value that indicates whether a new file can be created if the specified filename doesn't exist. The value is True if a new file is created, False if it isn't created. If omitted, a new file isn't created.formatOptional Setting. One of three Tristate values used to indicate the format of the opened file (TristateTrue = -1 to open the file as Unicode, TristateFalse = 0 to open the file as ASCII, TristateUseDefault = -2 to open the file as the system default). If omitted, the file is opened as ASCII.

Settings

iomode argument:

ConstantValueDescriptionForReading1Open a file for reading only. You can't write to this file.ForWriting2Open a file for writing.ForAppending8Open a file and write to the end of the file.

format argument:

ConstantValueDescriptionTristateUseDefault-2Opens the file using the system default.TristateTrue-1Opens the file as Unicode.TristateFalse0Opens the file as ASCII.

Applied to

FileSystemObject Object
Optional Element, Content Occurrence Character, Choice or sequence:(…)+one or more(…)*zero or more(…)?zero or one times(…)exactly once[…]optional(… | …)or( … & …)and( …, … )sequence⋯=⋯assign to⋯.⋯dot notation(+)include(-)exclude

Sideway BICK Blog

25/05


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013