MATLAB Function Reference Previous page   Next Page
rmdir

Remove directory

Graphical Interface

As an alternative to the rmdir function, use the delete feature in the Current Directory browser.

Syntax

Description

rmdir('dirname') removes the directory dirname from the current directory. If the directory is not empty, you must use the s argument. If dirname is not in the current directory, specify the relative path to the current directory or the full path for dirname.

rmdir('dirname','s') removes the directory dirname and its contents from the current directory. This removes all subdirectories and files in the current directory regardless of their write permissions.

[status, message, messageid] = rmdir('dirname','s') removes the directory dirname and its contents from the current directory, returning the status, a message, and the MATLAB error message ID (see error and lasterr). Here, status is 1 for success and is 0 for error, and message, messageid, and the s input argument are optional.

Examples

Remove Empty Directory

To remove myfiles from the current directory, where myfiles is empty, type

If the current directory is matlabr13/work, and myfiles is in d:/matlabr13/work/project/, use the relative path to myfiles

or the full path to myfiles

Remove Directory and All Contents

To remove myfiles, its subdirectories, and all files in the directories, assuming myfiles is in the current directory, type

Remove Directory and Return Results

To remove myfiles from the current directory, type

MATLAB returns

indicating the directory myfiles is not empty.

To remove myfiles and its contents, run

and MATLAB returns

indicating myfiles and its contents were removed.

See Also

cd, copyfile, delete, dir, error, fileattrib, filebrowser, lasterr, mkdir, movefile


Previous page  rmappdata rmdir (ftp) Next page

© 1994-2005 The MathWorks, Inc.