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...
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 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.