COPYFILE Copy Files

Section: Operating System Functions

Usage

Copies a file or files from one location to another. There are several syntaxes for this function that are acceptable:
   copyfile(file_in,file_out)

copies the file from file_in to file_out. Also, the second argument can be a directory name:

   copyfile(file_in,directory_out)

in which case file_in is copied into the directory specified by directory_out. You can also use copyfile to copy entire directories as in

   copyfile(dir_in,dir_out)

in which case the directory contents are copied to the destination directory (which is created if necessary). Finally, the first argument to copyfile can contain wildcards

   copyfile(pattern,directory_out)

in which case all files that match the given pattern are copied to the output directory. Note that to remain compatible with the MATLAB API, this function will delete/replace destination files that already exist, unless they are marked as read-only. If you want to force the copy to succeed, you can append a 'f' argument to the copyfile function:

   copyfile(arg1,arg2,'f')

or equivalently

   copyfile arg1 arg2 f