rmdir
Remove folder
Syntax
Description
rmdir removes the folder
folderNamefolderName from the current folder.
folderName must be empty. If the operation is not
successful, MATLAB® throws an error to the Command Window.
rmdir also attempts to
remove all subfolders and files in folderName sfolderName, regardless
of their write permissions. The result for read-only files follows the practices
of the operating system.
rmdir(
specifies whether to remove a symbolic link or its target. (since R2024b)folderName,ResolveSymbolicLinks=tf)
removes the specified folder and returns a status of status = rmdir(___)1 if the
operation is successful. Otherwise, rmdir returns
0. Warnings and errors are not thrown to the Command
Window. You can use this syntax with any of the input argument combinations in
the previous syntaxes.
Examples
Input Arguments
Output Arguments
Tips
As with local folders,
rmdircannot remove nonempty virtual folders unless you specify thesflag. Some file services do not support empty folders. On these services, ifrmdirremoves folders and leaves their parent folder empty, then the parent folder is removed as well. For more information, see Work with Remote Data.
Alternative Functionality
In the Files panel, right-click the folder name and select Delete from the context menu. To open the Files panel, use the
filebrowser command.