"rm" will happily remove whatever you tell it to! Depending on the complexity of what you want to do, it might take several command----or it might involve appending rm to a "find" command.
"rm -r *txt" removes all files ending in "txt" in the current directory--and all subdirectories whose name ends in "txt" (and contents). It will remove--e.g.:
file.txt
dirname_txt and all contents
but not:
dirname/file.txt
dirname/dirname_txt
Try this:
Code:
find . -name "*txt" -exec rm {} \;
This searches recursively, beginning in the current directory, for all filenames (including directories) in the current directory--and everything below. It will remove (assuming permissions allow) all files named *txt, but NOT directory names ending in txt. (for the latter, it will give an error message)