MATLAB Function Reference | ![]() ![]() |
Graphical Interface
As an alternative to the copyfile
function, you can copy files using the Current Directory browser. To open it, select Current Directory from the View menu in the MATLAB desktop.
Syntax
copyfilesource
dest
copyfilesource dest
writable
status = copyfile('source','dest',...) [status,msg] = copyfile('source','dest',...)
Description
copyfile
copies the file, source
dest
source
, to directory or file, dest
. The source
and dest
arguments may be absolute pathnames or pathnames relative to the current directory. The pathname to dest
must exist, but dest
cannot be an existing filename in the current directory.
copyfile
makes the destination file writable following the file copy.source
dest
writable
status = copyfile('source','dest',...)
returns a status
of 1 if the file is copied successfully and 0 otherwise.
[status,msg] = copyfile('source','dest',...)
returns status and a nonempty error message string when an error occurs.
Example
To make a copy of a file in the same directory,
copyfile myfun.m myfun2.m
To copy a file to another directory, keeping the same filename,
file_copied = copyfile('myfun.m','../testfun/private') file_copied = 1
See Also
![]() | convn | copyobj | ![]() |