FileCopy

The FileCopy function copies files from the source path to the destination path.

#### 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.

#### Syntax

ret=FileCopy(<source_filename>, <target_filename> [, forced])

#### Parameters

<source_filename>, string, file(s) to copy. To specify more than one file use wildcard characters (* or ?).

<target_filename>, string, destination folder and (optionally) file name for the file or files being copied.

forced, optional keyword. Add this keyword if a locked file must be replaced. The file is then replaced at the next Windows restart.

#### Return value

ret, optional numeric return value. If the function succeeds, the return value is 0. If the function fails, the return value is a nonzero value (see File Functions Error Codes).

#### Remarks

The FileCopy 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)

FileCopy(File1$, File2$)