To find files or directory recursively and delete it
Some times I do have need to find some file or directory which I need to delete .
I use the "find " and "exec" command
find . -name "CVS" -type d -exec rm -rf {} // for directory named CVS
find . -name "CVS" -type f -exec rm -rf {} // for file named CVS
The -exec operator execute any command. When using after "find" command it needs some way to distinguish the command it's executing from its own arguments. For this purpose u need to use the same end -of - command character as the shell(semicolon) . But since the shell uses the semicolon utself, it is necessary to escape the character with a backslah or quotes
or
we could use
find . -name "CVS" -type d | xargs rm -rf
Here "xargs" executes its commands and reads standard input to specify arguments to that command