Deleting the file only to all the directory and sub directory

I need the unix command or shell script to delete all the file in current directory and sub directory.

make sure you are in the correct directory before issuing the command:

rm -rf *

will remove all files and directories.

use with care!!!

Hi

rm -rf dirname

This had been answered numerous number of times, please use the search facility of the forum before posting a question; sometimes your question might have been answered already.

i want to remove only the files not the directory

you have to write a script which will travel through all directories present in current directory and so on. then grep only for files and delete them.

-nilesh

find files of type f and use xargs or exec to delete ( rm ) them

try searching the forums - for find, xargs, exec

If you want onlyy files to be deleted in the current directory then use
rm -f *

or use find /DIRNAME -type f -maxdepth 1 -exec rm -f {} \;

If you need to remove all files in teh SUBDirectories as well without removing SUBDirectories, then use

find /tmp/test -type f -exec rm -f {} \;