delete all items in a folder in LInux

Sainai
Sainai used Ask the Experts™
on
I can't remember but what is the command to delete all items in a folder in Redhat?

thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2009
Commented:
rm -rf /foldername

Carefull : it will delete Everything from that folder
Application Support Analyst
Commented:
r - for recursive

f - force
rm -rf ./foldername
 
or 
 
rmdir -rf *

Open in new window

Author

Commented:
well the command rm-rf ./foldername deletes everything including the folder. I just want to delete everything in the folder without deleting the folder. thnx
Kamaraj SubramanianApplication Support Analyst

Commented:
then go inside folder and apply the command

are you using in any shell script ?
Top Expert 2009

Commented:
lol
then go to the folder

cd folder

rm -rf *

so it will delete all , but not delete the parent folder

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial