%% Move File to Read-Only Folder
% Move the file myfile1.m from the current folder to the read-only folder restricted.
% Create the read-only folder restricted.

mkdir restricted
fileattrib restricted -w

% Move the file myfile1.m. A status of 0 shows the copy was unsuccessful.
%

status = movefile('myfile1.m','restricted');
status

% Move the file myfile1.m using the 'f' option to override the read-only status of the destination folder. A status of 1 and an empty message and messageID confirm the copy was successful.
%

[status,message,messageId] = movefile('myfile1.m','restricted','f');
status
message
messageId

% Copyright 2012 The MathWorks, Inc.