rmdir
Remove folder
Syntax
Description
rmdir
removes the folder
folderName
folderName
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,
rmdir
cannot remove nonempty virtual folders unless you specify thes
flag. Some file services do not support empty folders. On these services, ifrmdir
removes 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 Current Folder browser, right-click the folder name and select Delete from the context menu. To open the Current Folder browser, use the Current Folder Browser command.