vfsCopy

function

Library: File system utilities (OMVFS legacy)
Include: omvfs.xin

Declaration
define external function vfsCopy
       value  stream  sourcepath
   to  value  stream  targetpath

or

define external function vfsCopy
       value  stream  sourcepath
   to  value  stream  targetURL
   in  value  vfsDir  targetdir
   
or

define external function vfsCopy
       value  stream  sourceURL
   on  value  vfsDir  sourcedir 
   to  value  stream  targetpath
   
or

define external function vfsCopy
       value  stream  sourceURL
   on  value  vfsDir  sourcedir
   to  value  stream  targetURL
   in  value  vfsDir  targetdir

Argument definitions

sourcepath
is the copy source (directory or file to be copied), expressed in local file system format.
targetpath
is the copy target (directory or file location for the copy), expressed in local file system format.
sourceURL
is the copy source (directory or file to be copied), expressed as a relative URL using sourcedir as its base.
sourcedir
is a connected vfsDir object.
targetURL
is the copy target (directory or file location for the copy), expressed as a relative URL using targetdir as its base.
targetdir
is a vfsDir object created by connecting to a directory using either vfsConnect, or vfsConnectDir.


Purpose

Use vfsCopy to copy

from the source location to a target location.

Requirements

You must include the following line at the beginning of your OmniMark program:

  include "omvfs.xin"

The copy source sourcepath must:

The copy target targetpath must:

The copy source sourceURL must:

The vfsDir object sourcedir must:

The copy target targetURL must:

The vfsDir object targetdir must:

Usage Notes

If targetpath does not exist, targetpath will be the name of the copy source. If targetpath exists (is a directory) a copy of the copy source will be placed inside the directory targetpath.

If targetURL does not exist, targetURL will be the name of the copy source. If targetURL exists (is a directory) a copy of the copy source will be placed inside the directory targetURL.

External exception VFS300 is thrown for any general OS operation failure. The text accompanying the exception will contain details on the reason for the failure.

External exception VFS111 is thrown if an URL supplied as a parameter to this function contains invalid encoding.

External exception VFS004 is thrown if the URL exceeds system length limits.

For complete details on absolute URLs and valid encoding, see Internet Standards RFC 1738: Uniform Resource Locators.

For complete details on relative URLs, see Internet Standards RFC 1808: Relative Uniform Resource Locators.

Example #1: Copying a directory on the local file system

Making a copy of a directory and its contents at a new location with a new name.

  include "omvfs.xin"
  
  process
  	. . .
    vfsCopy "../version1" 
  	to "/oldversion"

Example #2: Copying a file from the local file system to a network resource.

Making a copy of a file at a new location with the same name.

  include "omvfs.xin"
  
  process
    local vfsDir Chicago
  	. . .
    set Chicago to vfsConnect "file:///ChicagoFormats/Style/"
  	. . .
    vfsCopy "../version1.exe" 
  	to "version1.exe"
  	in Chicago