Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to removed files in my folders that ends in .txt using ssh. This is what I have tried so far:

find /models/ -name *.txt" -type d -exec rm -rf {} \;

Inside these main folder model I have hundreds of subfolders with a file that ends in .txt and they need to be removed.

share|improve this question

migrated from Jan 3 '12 at 15:06

This question came from our site for professional and enthusiast programmers.

You missed a quote before *.txt". Not sure if that's a typo here or... – Rob Wouters Jan 3 '12 at 15:08

-type d means directory, so what you're doing is removing all directories ending in .txt. -type f will give you files.

share|improve this answer

You also have a problem with ":


find models/ -name "*.txt" -type f -exec rm -rf {} \;
share|improve this answer
Thank you guys I was avialble to removed those text files saved me hours of ftp folder by folder apreciated – Danny Sanjurnny Jan 4 '12 at 2:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.