CopyFile or Copy Link - Copy an Existing File
Valid on NetWare, Symbian OS, UNIX, Windows and Windows CE
cla140
Valid on NetWare, Symbian OS, UNIX, Windows and Windows CE
The CopyFile or CopyLink function copies an existing file to a new file.
Function format:
CopyFile( source as String, target as String, overwrite as Boolean) as Boolean CopyFile(source as String, target as String) as Boolean
- sourceThis parameter specifies the file name of an existing source file.
- targetThis parameter identifies the name of the new file.
- overwriteThis parameter specifies if the function overwrites an existing target. The default, TRUE, overwrites an existing target. If the target file already exists, FALSE causes the function to fail.
On completion, the function returns TRUE; otherwise, it returns FALSE.
Example:
This example creates a backup directory, copies autoexec.bat to the directory, and renames it to autoexec.bat.
HELP_GETFILEATTRIBUTES If Not(ExistDirectory("c:\backup")) then CreateDirectory("c:\backup") CopyFile("c:\autoexec.bat", "c:\backup\autoexec.bat") RenameFile("c:\backup\autoexec.bat", "c:\backup\autoexec.bak")