copyfile
Copy file or folder
Syntax
Description
copyfile copies the file or folder
sourcesource to the current folder. After a successful
copyfile operation, the timestamp for the new file is the
same as the timestamp for source.
copyfile
copies source destinationsource to the file or folder
destination.
If
sourceis a file, thendestinationcan be a file or folder.If
sourceis a folder, thendestinationmust be a folder.If
sourceis a folder or specifies multiple files anddestinationdoes not exist, thencopyfileattempts to createdestination.
copyfile copies source destination fsource to destination,
even when destination is not writable. The state
of the read/write attribute for destination does
not change.
copyfile(
specifies whether to copy a symbolic link or its target. (since R2024b)source,destination,CopyLinkBehavior=slbehavior)
copies the
specified file or folder and returns a status of status = copyfile(___)1 if the
operation is successful. Otherwise, copyfile returns
0. You can use this syntax with any of the input argument
combinations in the previous syntaxes.
Examples
Input Arguments
Output Arguments
Limitations
MATLAB® does not support internet URLs that require authentication.
MATLAB Online™ supports internet URLs associated with Microsoft® OneDrive™ files and folders, while the installed version of MATLAB supports only local OneDrive files.
Tips
This function supports Microsoft Windows® shortcut files (
.lnk).