How I Delete all empty directories in Linus

How to Delete all empty directories in Linus

How can I Delete all empty directories in Linus?

How I Delete all empty directories in Linus.

Instruction on how to Delete all empty directories in Linus

To delete all empty directories in a directory tree:

$ find /dir -type d -empty -delete


/dir: recursively search inside /dir directory
-type d: limits the search to directories:
-empty – limits the search to only empty directories.
-delete: removes all found empty directories in the subtree. It can only remove the empty directories.
Be very careful while using the -delete option. The find command is assessed as an expression, and if you include the -delete option first, the command will delete everything below the options you specified.

We strongly recommend you use the –delete option as the last resort.


An index is an area for putting away documents on a PC. It’s a document framework recording structure that contains references to different records or catalogs. Envelopes and documents are coordinated into various leveled structures, meaning coordinated in a way that looks like a tree. For instance, a registry contained inside another index is known as a subdirectory. The terms parent and kid are frequently used to allude to indexes and subdirectories, separately. The top-most catalog in a record framework is known as the root registry. Consider an index file organizer that contains envelopes. Inside these organizers’ documents.

This image has an empty alt attribute; its file name is capture-20220411-014011-crop-2.png

Document frameworks use indexes to arrange records inside a capacity gadget, for example, a hard circle drive or strong state drive. Framework documents might be situated in one registry, while client records might be put away in another. Various leveled document frameworks that incorporate catalogs are Linux, MS-DOS, OS/2, and Unix. It’s important that in a GUI, for example, Microsoft Windows, registries are known as organizers.

By putting away unambiguous kinds of records in an organizer, data can be handily gotten to. Projects can be put away in a registry also. At the point when a program is introduced, its documents are put away in a catalog that contains subdirectories with many records connected with the program. As a result of the catalog, records are more averse to getting overwritten, adjusted, or erased by different projects.