CopyFile

See Also: See Also: File_Exist, EraseFile, File I/O Commands, Copy_DB

Purpose

Copies one or more disk files

Syntax

CopyFile {source-file(s)} to {destination}

Where

What It Does

CopyFile copies the file(s) identified by {source-file(s)} to the file, folder, or drive identified by {destination}, creating any destination files which do not already exist, and overwriting any that do. CopyFile will use the current working folder, unless a path is provided as part of {source-file(s)} and/or {destination}. You may use any valid Windows file specification (including wildcard characters) for {source-file(s)}.

Example

This sample copies the file "foo.txt" in the current working folder to a file named "foo2.txt" in the same folder:

CopyFile "foo.txt" to "foo2.txt"

Example

This sample copies all files with file name "foo" and any file extension to folder "C:\MyFoo":

CopyFile "foo.*" to "C:\MyFoo"

Example

This sample copies the file "foo.txt" to drive "F:":

CopyFile "foo.txt" to "F:"

Example

This is sample copies all files with file name "vendor" and any file extension to a backup folder:

Procedure BackupVendorData

    String sDataFolder

    

    // replace {Revision} with DataFlex version, e.g. "14.1"

    Move "C:\DataFlex {Revision} Examples\Order Entry\Data" to sDataFolder

    

    Set_Directory sDataFolder

    Make_Directory "Backup"

    // Copy Vendor table to backup folder

    CopyFile "Vendor.*" to "Backup"

End_Procedure

 

Send BackupVendorData

Notes