Why can't I move a file to destination './Raw_+1:00' in MATLAB R2013b on Windows?

9 views (last 30 days)
I am using "movefile" to move a MAT-file from the MATLAB Curent Folder to a sub-folder named "Raw_+1:00". Here is my code:
>> movefile('test.mat', './Raw_+1:00')
Error using movefile
Cannot write to destination: C:\Documents\MATLAB\Raw_+1:00. Use the 'f' option to override.
I then try with the 'f' option as suggested by the error message and get:
>> movefile('test.mat', './Raw_+1:00', 'f')
Error using movefile
Unknown error occurred.
Am I doing something wrong?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Mar 2014
Colon (:) is an illegal character and cannot be used in the name of a file or a directory on Windows. The error message was changed in MATLAB R2014a to better reflect the cause of the issue:
Error using movefile
The filename, directory name, or volume label syntax is incorrect.
The full set of invalid characters can vary by file system. For example, on Windows-based desktop platforms, invalid path characters might include ASCII/Unicode characters 1 through 31, as well as quote ("), less than (<), greater than (>), pipe (|), backspace (\b), null (\0) and tab (\t).
  1 Comment
Steven Lord
Steven Lord on 29 May 2020
Here's what Microsoft has to say on the matter of file names, in part.
"Use any character in the current code page for a name, including Unicode characters and characters in the extended character set (128–255), except for the following:
  • The following reserved characters:
  • < (less than)
  • > (greater than)
  • : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • * (asterisk)
"
The file name in the original question contains the colon character which appears on the list of reserved characters.

Sign in to comment.

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products


Release

R2013b

Community Treasure Hunt

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

Start Hunting!