0

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

2

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.

| improve this answer | |
  • Thanks. I would move it to the correct board but as you kindly answered I will not. Thanks again :) – Andrew Simpson 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

Not the answer you're looking for? Browse other questions tagged or ask your own question.