Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 3
    Note: "to count non empty and empty directories with size 4096" (the title) and "to count empty and non empty directories" (the first sentence of the body) are two different tasks. In ext a directory can take more bytes regardless whether it's empty or not. It's not clear which task you want. Please edit and clarify. Commented Aug 29, 2021 at 7:13
  • the 4096 size is the size of the inodes needed to contains the list of files+dirs within that directory. It will be 1 block of inodes (4k) if the dir was always empty or always had few files+dirs within, or more if you have many files+dirs within that directory. Once it is enlarged to hold a long list of filenames, it will not shrink back after you delete those files. You would need to create another dir and replace it with that new one. Commented Aug 30, 2021 at 7:05