Skip to main content
Tweeted twitter.com/StackUnix/status/865053428912971776
edited title
Link
don_crissti
  • 85.7k
  • 31
  • 234
  • 262

How to delete all files from root directory where the sub directory names are samecontent of all subdirectories named "output"?

added 6 characters in body; edited tags
Source Link
don_crissti
  • 85.7k
  • 31
  • 234
  • 262

I downloaded a project from web.When building the project it produces output files in folder named Outputoutput.The problem is there are many folders with same name.I need to manually delete the files in all outputoutput 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 outputoutput folder iI want to delete all the files under the outputoutput folder name.

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.

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.

Source Link
Jeeva
  • 245
  • 1
  • 4
  • 10

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.