Why do the COPYFILE and MOVEFILE functions fail, but return no message or message ID in MATLAB 6.5 (R13)?

3 views (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
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.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!