%% Remove Nonempty Folder
% Remove the folder myfiles, which contains the files myfile1.m and myfile2.m.
% Create the folder myfiles and move the files myfile1.m and myfile2.m from the current folder into the new folder.

mkdir myfiles
movefile myfile1.m myfiles
movefile myfile2.m myfiles

%
% Try to remove the folder myfiles using rmdir. Because the myfiles folder is not empty, the operation fails and returns a status of 0 and an error message detailing why the operation failed.

[status, message, messageid] = rmdir('myfiles')

%
% Now, use the 's' flag to remove the folder myfiles. A status of 1 and an empty message and messageid indicate that the operation is successful.

[status, message, messageid] = rmdir('myfiles', 's')

%
% Copyright 2012 The MathWorks, Inc.