Skip to content

Help us create more tutorials! Make a donation using the Donate button or become a member using the button below to hide this banner and track your progress.

Delete a directory – Terminal


To delete an empty directory using your terminal, enter the following command:

rmdir folder-name


The above command only works if the directory is empty. If the directory isn’t empty, you will see the following print out:

rmdir: folder-name: Directory not empty

Delete multiple folders

To delete multiple folders, pass in multiple folder names as arguments to the rmdir command, like this:

rmdir folder-1 folder-2


Try the following command in your project folder:

rmdir css

You should see the following print out:

rmdir: css: Directory not empty

Then run the following commands:

rm css/style.css
rmdir css


Command Line Primer on the Apple Developer Archive (see the section called Frequently Used Commands)

Back to: Terminal Course > Terminal Advanced Commands