MATLAB: Do the COPYFILE and MOVEFILE functions fail, but return no message or message ID in MATLAB 6.5 (R13)

copyfilefailMATLABmessagemovefile

Why do the COPYFILE and MOVEFILE functions fail, but return no message or message ID in MATLAB 6.5 (R13)?
I am trying to use COPYFILE to copy a file in my current working directory:
[success,msg,msgid] = copyfile('file1.m','file2.m');
The copy fails, but the return values for "msg" and "msgid" are empty strings. I experience the same behavior with MOVEFILE. How can I determine what caused the problem?

Best Answer

This is a bug in the FILEATTRIB function, which is called by functions such as COPYFILE and MOVEFILE, in MATLAB 6.5 (R13). Our development staff is investigating this issue.
Currently, to work around this issue, use your system's copy command directly, with the SYSTEM function.
On Unix/Linux:
system(['cp -r ' Source ' ' Destination])
On Windows:
system(['copy ' Source ' ' Destination])
where "Source" is the source file, and "Destination" is the destination location. Check the system documentation for more information on the options available with their copy commands.