How to tracking downloads (in groups) from folders?

Hi,

I have a website that consists of many files to download/display (pdf, word etc). The service on a tree structure:

test.pl/articles/
test.pl/articles/year1900/xxx.pdf
test.pl/articles/year1921/yyy.doc
test.pl/articles/year1921/iii.pdf
test.pl/articles/year1921/zzz.pdf

test.pl/journals/
test.pl/journals/year2000/111.pdf
test.pl/journals/year2022/222.doc
test.pl/journals/year2022/333.doc

I would like to keep track of all the downloads of different files from the following folders:

test.pl/articles/*
test.pl/journals/*

How can I do this, can I ask for an example? Thank You

Karol