Copies one or several files.
Parameters
- cSource
One or more file names. These names should be fully-qualified paths to prevent unexpected results.
Standard MS-DOS wildcard characters, such as "*", are permitted only in the file-name position. Using a wildcard character elsewhere in the string will lead to unpredictable results.
Each file name should be terminated by a single CHR(0).
- cTarget
The destination file or directory name. Wildcard characters are not allowed. Their use will lead to unpredictable results.
cTarget must meet the following specifications:
Wildcard characters are not supported.
It can specify destination directories that do not exist. In those cases, the system attempts to create them and normally displays a dialog box to ask the user if they want to create the new directory. To suppress this dialog box and have the directories created silently, set the FOF_NOCONFIRMMKDIR flag in nFlags.
It can contain multiple destination file names if the nFlags parameter specifies FOF_MULTIDESTFILES.
Use fully-qualified paths. Using relative paths is not prohibited, but can have unpredictable results.
- nFlags (additive)
default is none of the below:
Flag Description FOF_ALLOWUNDO Preserve undo information, if possible.
Operations can be undone only from the same process that performed the original operation.
If pFrom does not contain fully qualified path and file names, this flag is ignored.FOF_FILESONLY Perform the operation on files only if a wildcard file name (*.*) is specified. FOF_MULTIDESTFILES The cTarget parameter specifies multiple destination files (one for each source file) rather than one directory where all source files are to be deposited. FOF_NOCONFIRMATION Respond with "Yes to All" for any dialog box that is displayed. FOF_NOCONFIRMMKDIR Do not confirm the creation of a new directory if the operation requires one to be created. FOF_NO_CONNECTED_ELEMENTS Shell Version 5.0. Do not move connected files as a group. Only move the specified files. FOF_NOCOPYSECURITYATTRIBS Shell Version 4.71. Do not copy the security attributes of the file. FOF_NOERRORUI Do not display a user interface if an error occurs. FOF_NORECURSION Only operate in the local directory. Don't operate recursively into subdirectories. FOF_RENAMEONCOLLISION Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists. FOF_SILENT Do not display a progress dialog box. FOF_SIMPLEPROGRESS Display a progress dialog box but do not show the file names. If you pass the cTitle parameter, FOF_SIMPLEPROGRESS is automatically set.
- cTitle (optional)
Title of the progress dialog.
If you pass this parameter, the FOF_SIMPLEPROGRESS flag is automatically set since one cannot specify a title without setting this flag.
Return Value
1 if all files were copied successfull, 0 if the operation was aborted, otherwise the errorcode from the SHFileOperation API.
See Also
Reference
SHDeleteFiles
SHMoveFiles
SHRenameFiles
SHSpecialFolder