I have a mono app and it delete all empty folders in a folder tree.

Is there a way to do this via the command line? The idea is that I would call it as an external process.

I had tried this:

sudo rm r <folder>

but it deletes folders that have files in it...


While this is not a Raspberry Pi specific question but rather a Linux/Unix command line question here is how I do it:

find <folder> -type d -empty -delete

in words: Find all file system entries in <folder> of type directory which is empty and go delete it.

  • Thanks. I would move it to the correct board but as you kindly answered I will not. Thanks again :) – user11286 Dec 3 '19 at 16:36

Your Answer

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