Download file in a specific folder from Google drive

I am facing a problem here:

I am trying to download all files in specific folders in Google Drive. There are multiple folders with the same name in the drive, i need everything in all the folder with that name and nothing else.
I am using Find Files and Folder activity, here’s the query I put in:

“mimeType=‘application/vnd.google-apps.folder’ and name = ‘XXXX’ in parents and name contains ‘X’ or name contains ‘XX’ or name contains ‘XXX’”

It returns error 400 where i believe there’s something wrong with query. I am not familiar with google api query and was hoping i could get some help

I also tried downloading the entire folder with:
“mimeType=‘application/vnd.google-apps.folder’ and name = ‘XXXX’” as the file id, which didn’t work.

Thanks in advance for your help!

to make sure it is not the filter, did you try with only "name = 'folder name'"?

More help in here:
https://developers.google.com/drive/api/v3/search-files

Hi, I did try name = “folder name” and it returns only the folder’s ID, but i need the files’ id.

I also looked through the link and couldn’t find what I need.

what do you mean, could not find what you need? If so, then you are out of luck, cause that is the official google docs for the service you are trying to use… If you want to download all in a folder, you need to get all IDs and download each at a time.

Update:
I did find a work around for my problem. I searched for the folders and got all of their ID, and did 10 different Find Files and Folder activity with query:

"‘FolderID’ in parents and and name contains ‘X’ or name contains ‘XX’ or name contains ‘XXX’”

Folder ID is hard coded (a string of random letter and number) since I couldn’t use a UiPath variable inside a Google API query apparently.
This solves my current problem, but in the future if there were to be a new folder, I would not be able to capture that anywhere since I would have to go back to the robot and add a new Find Files and Folder activity with new folder ID.

This seems very stupid and i don’t like it. If someone has a better approach, please let me know.

There is no other approach, you need to first find the folders you want to download the files from, after that you use that id to search the files inside it and download each one…

Sure, thanks!