Check if folder exists before moving file(s)

Hi everyone and thanks for your future help

I’am developping an automation about moving attachments from a specific sender to a folder.
I succeded in creating the projet, I can connect my imap account, I can filter my sender and write the filtered attachment in a specific folder (on my network).

But I would like to check before writing files if some folders are existing :
-First, check if the folder of the year is created, if yes open it, if no create it and open it and continue.

  • Second, check the month folder and create it if doesn’t exist and open it

And actually write the file(s) in the last folder.

Can someone give me hints, I’m just a total noob in programming and It’s been a very short time since I started on n8n ?

I’m running n8n 1.91.3 in a Proxmox container

Thank you for your help.