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.

link|improve this question
You missed a quote before *.txt". Not sure if that's a typo here or... – Rob Wouters Jan 3 at 15:08
feedback

migrated from stackoverflow.com Jan 3 at 15:06

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

2 Answers

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

link|improve this answer
feedback

You also have a problem with ":

try:

find models/ -name "*.txt" -type f -exec rm -rf {} \;
link|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 at 2:01
feedback

Your Answer

 
or
required, but never shown

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