Delete Empty Folders
This command will delete all the empty folders in your current directly and all its children.
- The "." specifies that we want to search from our current directory.
- "-depth" gives a recursive effect to this.
- The "-type d" specifies that we only want to return directories.
- "-empty" finds regular files and folders but the "-type d" part makes it so that we only find directories.
- The items found after "-exec" are to be executed each time an item is found.
- "rmdir" removes only empty directories. One could also write "rm -r" but that is less safe since it will also remove directories that are not empty.
- The " "{}" " acts sort of like a variable that holds the name of the item that was found. The double quotes around it may not be needed, but, it didn't hurt the execution of the command when I ran it.
- And, the "\;" finishes it all off.