9
10Dev
4y

I can't be the only one who didn't know that Linux has a specific command to delete a directory

I've used Linux all my developer career and I never knew the command 'rmdir' existed. I always just used 'rm -rf'

Comments
  • 0
    What now?
  • 11
    Meh, it's well known but seldom used as it'll only remove an empty dir. Useful if you want to ensure its empty before purging, but in reality that's a niche use case these days.
  • 0
  • 2
    @AlmondSauce it's quite handy to remove dangling directories. We had a piece of software that balanced uploads by creating 3 layers of directories. This worked well but as it also did this for temporary files and we had many instances running so it would exhaust inode count.
    A scheduled find with rmdir worked wonders.
  • 1
    @hjk101 Yeah there's situations like that where it's useful - but I'd still class that as a bit of a niche use case.
Add Comment