Find -Exec Rm -R Print Delete

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?

1

1 Answer

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest