How to check whether a Folder/Subfolder is present in Google drive

Hi Anil,

Can you help with the multiple subfolders condition. It would be great!

Thank You

1 Like

Hi Anil,

Can you help with the multiple subfolders condition. Thank You in advance!!
Thank You

@dutta.marina

Can you tell what fo you mean …like what exactly are you looking for?

Cheers

Hi Anil,

I have condition where I have created a folder Out_Folder. I can check whether folder exist or not by using your method which you told earlier. Now I am stuck because my condition is

Under Out_Folder I have another subfolder called Region(Under Region I have two sub folders EMEA AND AMER).Under EMEA I have subfolders (EMEA ENETRPRISE ) AND EMEAGSC.

UNDER AMER I have two sub folders (AMER ENTERPRISE AND AMER GSC.) Attached Screenshot.
REGION/BUSINESS UNIT/ACCOUNT NAME. Attached Screenshot. Please guide on this.

Attached code also. Please Guide on this.
Account

G-Suite (3).zip (5.0 KB)

@dutta.marina

Then run a loop and keep the first condition inside the loop and use each column value and row value to check and change the values

Cheers

Hi @Anil_G

I got your point but if you could explain a little bit in details that would help me.

I have to put multiple sub conditions and create sub folders .That’s the part I am stuck with. Individually for each folder I am able to check the condition and create folders. But checking whether subfoders exist and if not create thats where it getting bit complex.

Thank You once again for your help.

@dutta.marina

Please check this…try and let me know

in this dt is the datatable that you will read…change the column names if they are different




G-Suite.zip (5.2 KB)

Hope this helps

cheers

@Anil_G Thank You for the help. Just one question what you are doing in assign activity.

output(0).DriveIdoutput(0).DriveId

Also let me try it out if that works I will let you know and mark it as the solution.

Thank You

1 Like

@dutta.marina

For the next find files it needs a folder id when it is to be created right…so i am retreiving that drive id value into the same out_folder which is assigned in create folder in else condition

Cheers

Hi Anil,

I tried to implement what ever you suggested but get following API error. I checked the folder path also in drive. Unable to understand why its giving API error. Also why output(0). why this 0 .are we trying to get the first element of array (drive id )

@dutta.marina

Yes zero is to get first item of the array…like ideally there would be only one file matching…if multiple matches then we need to make it more unique or find other ways to identify…

The exception is file not found…did you provide the correct file ? Looks like its not able to find the file you are checking for

In the find files I see input_Accountnames…is that a variable?

If yes then you added it as a string and not as variable

You need to add variable like this

"Name = '" + input_accountnames + "'"

Assuming it is a string variable

Cheers

Hi Anil,
“name = ‘Input_AccountNames’” here Input_AccountNames is the folder name which I am trying to search in my drive .Its not a variable.

@dutta.marina

Then can you please point where exactly it failing and as per error as mentioned before it is not able to find the path or file you are trying to give

Cheers

HiAnil,

It’s failing in find files and folders .

@dutta.marina

Please check the folder name properly and then use it…

As it is hardcoded value nothing should be missing as well

cheers

Hi Anil,

Even if its not able to find folder it should create one. As we have put if condition. Its not going to if condition also.I have used Service Account key.

image

Hi Anil, @Anil_G

The folders EMEA and AMER is created outside region folders. I have used exacty how to told to use the code. Please find the attached screenshot and code


Google_Drive_Folder_Creation.zip (7.9 KB)

Hi Anil, @Anil_G

The folders Business Unit is created outside region folders. I have used exacty how to told to use the code. Please find the attached screenshot and code
Google_Drive_Folder_Creation.zip (7.9 KB)

@dutta.marina

I guess in create folder you need to use region_folder and not the out_Folder

cheers

Hi Anil,

Till region i)AMER and 2) EMEA I am getting correctly. But after that the for each row in data table is not working . its creating everything in the root folder . Something like this.