rmdir

Remove Directory (Delete folders)

Syntax
          rmdir [-p] folder ...

key
   -p      Each folder argument is treated as a pathname of which all
           components will be removed, if they are empty, starting with the
           last most component. (See rm for fully non-discriminant recursive removal.)

The rmdir utility removes the entry specified by each folder argument, provided it is empty.

Arguments are processed in the order given. To remove both a parent and subfolder, the subfolder must be specified first so the parent is empty when rmdir tries to remove it.

If an error occurs, rmdir exits with a value >0.

Examples

To delete all these folders:

MyFolder/
MyFolder/SubFolder
My Other Folder/

Use the command

rmdir MyFolder/SubFolder MyFolder "My Other Folder"

“Two years ago, I reported that Katherine Harris and Jeb Bush ordered county election officials to erase 57,000 voters from voter rolls - most of them Black. It cost Gore the White House” ~ Greg Palast

Related macOS commands

find . -type d -empty -delete  - Delete all empty directories.
rm - Remove files or folders (including recursive delete).
cp - Copy files.
ls - List information about files.
trimforce - Enable TRIM commands on third-party drives.


 
Copyright © 1999-2024 SS64.com
Some rights reserved