Skip to main content
2 of 3
added 6 characters in body; edited tags
don_crissti
  • 85.7k
  • 31
  • 234
  • 262

How to delete all files from root directory where the sub directory names are same

I downloaded a project from web.When building the project it produces output files in folder named output.The problem is there are many folders with same name.I need to manually delete the files in all output directories.

I used this command

find . -type d -name "output" -print 

It displays the location of all directories with same name.

Then i used this command

find . -type d -name "output" -delete 

find: cannot delete ‘./output’: Directory not empty

I don't want to delete the output folder I want to delete all the files under the output folder name.

Jeeva
  • 245
  • 1
  • 4
  • 10