3 added
1 removed
Original
2026-01-01
Modified
2026-02-21
1
-
<p>pages.courses.lessons.theory_unit.sign_up_block_title</p>
1
+
<p>Full access to materials</p>
2
+
<p>Sign up and get access to this and dozens of other courses</p>
3
+
<p><a>Sign up</a></p>
2
<p>Let's practice with another option for data aggregation on file systems. We'll write a function that accepts a directory as input and returns a list of directories of the first level of nesting and the number of files inside each of them, including all subdirectories:</p>
4
<p>Let's practice with another option for data aggregation on file systems. We'll write a function that accepts a directory as input and returns a list of directories of the first level of nesting and the number of files inside each of them, including all subdirectories:</p>
3
<p>We can break this task down into two steps:</p>
5
<p>We can break this task down into two steps:</p>
4
<ul><li>Counting the number of files inside a directory</li>
6
<ul><li>Counting the number of files inside a directory</li>
5
<li>Calling the file counting function on each of the subdirectories</li>
7
<li>Calling the file counting function on each of the subdirectories</li>
6
</ul><p>Let's start by counting the number of files. It is a classic aggregation task:</p>
8
</ul><p>Let's start by counting the number of files. It is a classic aggregation task:</p>
7
<p>The next step is to extract all the children from the source node and apply a count to each of them:</p>
9
<p>The next step is to extract all the children from the source node and apply a count to each of them:</p>
8
<p>In other words, we addressed the children directly, filtered them, and then mapped them to the necessary array containing names and numbers of files for each directory.</p>
10
<p>In other words, we addressed the children directly, filtered them, and then mapped them to the necessary array containing names and numbers of files for each directory.</p>