<< cd Files and folders functions diff_file >>

copyfile


Copy files or folder.


Syntax


copyfile(source, destination)
[status, msg] = copyfile(source, destination)
[status, msg] = copyfile(source, destination, 'f')

Input argument


source

a string: file or directory.

destination

a string: file or directory.

'f' or 'F'

force copy even destination is not writable.

Output argument


status

a logical true or false

msg

a string: error message

Description


copyfile(source , destination) copies the file or directory , source (and subdirectories) to the file or directory, destination.

If source is a directory, destination can not be a file.

copyfile replaces existing files without warning.

Example


copyfile([nelsonroot(), '/etc/startup.m'], [tempdir(), 'startup.m'])
[status, msg] = copyfile([nelsonroot(), '/etc/startup.m'], [tempdir(), 'startup.m'])

See also


isdir, rmfile.

History


Version Description
1.0.0 initial version
1.4.0 input arguments support scalar string array type

Author


Allan CORNET

<< cd Files and folders functions diff_file >>