Storages & Files MoveElementTo
MoveElementTo method

Moves an element (item) from this storage to another.


variable = obejct.MoveElementTo(element_name, target_storage, target_element_name)


element_name - name of the item (element) to move

target_storage - other SFStorage object.

target_element_name - name of the copied element in the target storage.

returned value: Boolean success indicator.


Set sf = Server.CreateObject("newObjects.utilctls.SFMain")
Set stgFile = sf.OpenStorageFile("C:\MyStgFile.stg")
Set dir = sf.OpenDirectory("C:\Mydirectory")
If dir.MoveElementTo("myfile.txt",stg,"file1.txt") Then
  Response.Write "Successfully moved the file to the OLE file"
  Response.Write "Error moving the file to the OLE file"
End If
' The sample moves a file in the OLE file - as one stream in it


This method allows the application to move sub-storages or streams from one storage to another. The nature of the both storages is not important - the items can be moved from any storage to any other storage.

However the storages themselves implement optimizations when the operation concerns two storage of the same type. For example the implementation of storage behavior over directories (in this library) uses the system supplied API functions for file moving. Therefore the operation will be as fast as possible depending on the storages type.

Applies to: SFStorage object

See also: CopyElementTo

newObjects Copyright 2001-2006 newObjects [ ]