Google Apps Script - Move Files from Parent Folder to Destination Folder

Viewed 25

I currently have a parent folder in Google Shared Drive where new files are saved at the beginning of each month for different food products. I'm trying to figure out how to move the corresponding food files into the latest months subfolder in each food folder

Below is an image of how the process works. In September, I received some files with the following names in the Parent Folder for the donut and cake category. My goal is to then move the donut files from the Parent folder to the August 2022 folder in Donut Folder and then move the cake files from the Parent folder to the August 2022 folder in the Cake Folder. Next month (October), when I get the new files, I would then need to move the donut files from the Parent folder to the September 2022 folder in Donut Folder and then move the cake files from the Parent folder to the September 2022 folder in the Cake folder.

enter image description here

One of the challenges is that there is a Monthly Files SubFolder and a 2022 SubFolder in between the Donut Folder and August 2022 SubFolder. I wasn't sure what to do about that. I have the folder Ids for the Parent Folder and the Food Folders. But since the month and year folder will vary based on which month we do this, is there a way to read the folder name and save the files in the right month subfolder inside the right food folders?

I'm stumped by this and I would really appreciate the help in figuring this out.

0 Answers
Related