-7

I am doing this

rm -r users/path/DIR/ *

and it deletes DIR.

I want to delete all contents of DIR without deleting DIR.

I also want to execute this shell script while being in root dir.

ANSWERED: rm -rf instead of rm -r

dennis
  • 1
  • 1
  • 2
    Oh... Take care with this rm -r users/path/DIR/ *! There is a space before the * That means it deletes recusively all that is in the current directory + the DIR – chaos Sep 29 '15 at 12:43

1 Answers1

0

You have a space between users/path/DIR/ and *. The correct command is :

rm -r users/path/DIR/*

If you also want to delete hidden files run :

rm -r users/path/DIR/* users/path/DIR/.*
hg8
  • 1,440
  • i tried what u said and i get this

    rm: cannot remove `/users/path/DIR/*': No such file or directory

    – dennis Sep 29 '15 at 14:17