copyfile
Returns R after copying file(s) or directories from src to dst.
Syntax
R = copyfile(src, dst)
[R, msg, id] = copyfile (src, dst, 'f')
Inputs
- src
- Source file or directory which may contain wild cards.
- dst
- Destination file or directory. If src represents multiple files, dst must be a valid directory.
- 'f'
- Force copy flag which attempts to overwrite dst, if it exists.
Outputs
- R
- 1 on success and 0 on failure.
- msg (optional)
- System dependent message on failure.
- id (optional)
- System dependent message ID on failure, or empty string on success.
Examples
Successful copy of a file to a destination directory:
R = copyfile('foo.txt', 'c:\tests\A')
R = 1
Successful copy of source name with a wild card and force copy option
[R, msg, id] = copyfile('fo*.txt', 'c:\tests\', 'f')
R = 1
msg =
id =
Unsuccessful copy of a file, with a system message and ID:
[R, msg, id] = copyfile('zzz.txt', 'c:\')
R = 0
msg = No such file or directory
Copy failed from [foo.txt] to [c:\]
id = 2