BASH Programming by Patrik

How to delete a Folder in Bash

Remove a Single Folder

To remove a folder, which is empty, use the following command:

$ rmdir folder-name

Remove the non-empty folder

Use the 'rm' command with the '-r' option followed by the name of the folder to be deleted:

$ rm –r folder-name

In this command '-r' flag refers to deleting all the contents of a folder first.

Comments

Leave a Comment

All fields are required. Your email address will not be published.