Logical construction of a flow

Hi everyone.
I need help, to build the logic of a work flow that I would call similar to a “matryoshka”.


The bot must back up the files, contained in the cloud.
The bot is partially already registered.
Currently, it is able to collect and backup all files in the Main List. (not in folders).

For some weeks now, users have been creating folders.
and inside it are inserted other files to be archived.
(AAA TEST FOLDER , Digital Program, are folder).

I can’t create a stream that goes in and out of folders continuously.
I can understand with my bot what File is
and what is Folder, creating separate tables.
But when I go into a folder, there are other files inside it, which I should be scraping and then backing up.
Go back to the upper level, go to the next line, and if it is a folder, enter and repeat the operations, if it is a file, perform a direct backup.

Can anyone help me with the flow building logics?