FileCopy
File management function.
The FileCopy function copies the specified source file to the specified target file.
Usage
Do not copy files using Drag and Drop in Explorer; drag and drop automation is not reliable as the way to display files in Explorer depends on Windows settings for each user. Use instead FileCopy function. Wildcards (* or ? characters) are allowed in the file names.
Syntax
FileCopy(<source_filename>,<target_filename> [,forced])
or
ret=FileCopy(<source_filename>,<target_filename> [,forced])Parameters
<source_filename>, string, name of the file to copy.
<target_filename>, string, name of the destination file.
forced: optional keyword. It is used when a locked file must be replaced (for instance, a file can be locked because it is in use). In that case, it will be replaced at the next Windows restart.
Return value
Ret, numeric return code. When the copy is successful, the function returns 0, otherwise use this return code for Error Handling.
Remarks
The function works like the DOS statement COPY. If you need a more complex COPY, use the Dos command xcopy with ShellWait function. Here is an example:
shellwait("xcopy c:\*.* d:\save /S",1,1000)
Examples
Ret = FileCopy("c:\*.txt", "i:\text\*.txt")
FileCopy(File1$, File2$)