3

I have navigated to the desired folder in my command window and I would like to delete all files and folders within the specific directory where I am currently located. I do not want to delete any files/folders outside of this directory.

How can I go about achieving this?

2 Answers2

10

rm -r /path/to/dir/*

  • - r is for deleting also subdirectories

  • * is for selecting all the files in the directory

4

Use the command:

rm -rf *

So far your in the desired folder that should remove all that's there.

-r: recursive or move into any directory in that location

-f: ignore nonexistent files and arguments, never prompt

*: all the contents of that location

George Udosen
  • 37,534