How to Delete the Contents of a Folder using Terminal

In this article, we are going to see how to delete the contents of a folder using terminal without deleting the folder itself.

For this, you can execute the following command :

$ rm -r “yourfoldernamewithpath/“*

This command will remove all the contents of the folder that you specify without deleting the folder. Please ensure that no space is there between the file name and *