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 one more data aggregation technique on file systems. Let's write a function that takes a directory as input and returns a list of directories on the first level of nesting and the number of files inside each of them, including all subdirectories.</p>
4
<p>Let's practice one more data aggregation technique on file systems. Let's write a function that takes a directory as input and returns a list of directories on the first level of nesting and the number of files inside each of them, including all subdirectories.</p>
3
<p>This task breaks down into two smaller ones:</p>
5
<p>This task breaks down into two smaller ones:</p>
4
<ul><li>Implementing the function counting files in a directory</li>
6
<ul><li>Implementing the function counting files in a directory</li>
5
<li>Calling this function for each of the subdirectories</li>
7
<li>Calling this function for each of the subdirectories</li>
6
</ul><p>Let's start by counting the number of files. This is a classic aggregation task:</p>
8
</ul><p>Let's start by counting the number of files. This is a classic aggregation task:</p>
7
<p>The next step is to extract all the children from the initial node and apply a count to each of them:</p>
9
<p>The next step is to extract all the children from the initial node and apply a count to each of them:</p>
8
<p>I.e., we accessed the children directly by first filtering them, and mapped them to the desired array, which contained the name and number of files for each directory.</p>
10
<p>I.e., we accessed the children directly by first filtering them, and mapped them to the desired array, which contained the name and number of files for each directory.</p>
9
<h2>Recommended programs</h2>
11
<h2>Recommended programs</h2>