Score:2

find -exec rm -r print delete

jp flag

I am trying to delete terabytes worth of folders and would like to see that things are actually being deleted. Currently, the command

find . -name "labelled_point_clouds" -type "d" -exec rm -r {} +

doesn't show anything and I will be left waiting for days not knowing if it is doing something. How can I have the command also output each folder it deletes?

bac0n avatar
cn flag
It's mandatory to use `-depth` in these situations, or `find` may feed objects to `-exec` that's already been deleted.
Score:3
cn flag

Your command is almost right. You should add the verbose flag to the rm command that you want to execute to see progress and paths removed.

find . -name "labelled_point_clouds" -type "d" -exec rm -r -v {} +

I added a directory structure similar to yours and put in a few files just for illustration.

find . -name "labelled_pointclouds" -type d -exec rm -r -v {} + 

removed './2/labelled_pointclouds/NARA-21-0006-0001_content.pdf'
removed directory './2/labelled_pointclouds'
removed './4/labelled_pointclouds/NARA-21-0006-0007_content.pdf'
removed './4/labelled_pointclouds/NARA-21-0006-0001_content.pdf'
removed directory './4/labelled_pointclouds'
removed './1/labelled_pointclouds/NARA-21-0006-0007_content.pdf'
removed directory './1/labelled_pointclouds'
removed './3/labelled_pointclouds/NARA-21-0006-0001_content.pdf'
removed directory './3/labelled_pointclouds'
removed directory './5/labelled_pointclouds'

So you can see the files removed and then the directory removed once it is empty.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.