Storages & Files CopyTo
CopyTo method

Copies the entire contents of this storage to another


variable = object.CopyTo( destStg)


destStg - The destination SFStorage object to copy to

returned result: Boolean success indicator


Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
Set stg = sf.OpenStorageFile("C:\mystoragefile.stg")
Set dir = stg.OpenDirectory("C:\mydirectory")
If dir.CopyTo(stg) Then
  ' Success report
  ' Failure report
End If
' The sample "puts" the contents of the mydirectory to a storage file.
' I.e. the fastest way to archive a directory in an OLE file


This method is optimized by the implementations of the storage objects if they are both of equal type.

Usage of the method can be described as archiving or unarchiving of entire directory trees when one of the storages is a directory and the other is a storage in an OLE file or other packaging format (external)

The entire content of the source storage is copied to the target storage. When a stream in the destination has to be replaced it is first removed from the destination. Therefore you ahould be careful with the sharing modes in order to allow the method to proceed the source elements under the source storage should be readable and the elements in the target storage should allow write and even full access (for the streams). The simplest way is to ensure there are no elements opened from the both storages.  

Applies to: SFStorage object

newObjects Copyright 2001-2006 newObjects [ ]