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
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
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/.*
rm: cannot remove `/users/path/DIR/*': No such file or directory
– dennis Sep 29 '15 at 14:17
rm -r users/path/DIR/ *
! There is a space before the*
That means it deletes recusively all that is in the current directory + theDIR
– chaos Sep 29 '15 at 12:43