cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alopez222
Helper III
Helper III

Trying to find existing folders

To begin, I have two different excel spreadsheets, one used to make folders and the other used to upload into the newly created folders. The spreadsheet used to create the folders is named CFGSchedule and I am creating folders based upon the values in a column within the spreadsheet. The name for these folders are also those values. Once these folders are created I upload the second spreadsheet, Lineup Template, inside the new folders. 

 

The issue is that I want to create folders only when there isn't an already existing folder. I am trying to implement the idea from the link below but it seems like I can't do it with an 'Apply to Each' action. What should I do? Also, I am completely new to this.

https://mydevexperience.wordpress.com/2020/02/08/power-automate-how-to-find-a-folder-exists-dynamic-...

 

alopez222_0-1643397052499.png

Thanks for any help given.

1 ACCEPTED SOLUTION

Accepted Solutions
jinivthakkar
Dual Super User
Dual Super User

@alopez222 you just have to initialize a variable outside the loop and then set variable in the loop

View solution in original post

4 REPLIES 4
jinivthakkar
Dual Super User
Dual Super User

@alopez222 you cannot initialize a variable in the loop but you can use it in the loop, just move that action out of the loop and try again it should work.

Even the link you are referring has not initialized a variable in the loop so not sure why and how you did that 

--------------------------------------------------------------------------------

If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

 

From what I understand, the variable that produces the error is checking the folder name. In my case the folder name is equal to the varying values of the Project column in the excel spreadsheet. The name of the folders will be the values seen in the picture below. But one of the issues I have is that there are some repeating values which is why I am trying to create something that will prevent creating duplicate folders. Having said that, from what I understand, in the link they are setting the variable to a folder name already. How can I do this when I want to check different folder names?

 

 

alopez222_0-1643737547732.png

 

jinivthakkar
Dual Super User
Dual Super User

@alopez222 you just have to initialize a variable outside the loop and then set variable in the loop

I'm completely new to this but I think I did what you suggested. I tested it and got this. It says the flow ran successfully.

Your suggestion:

alopez222_4-1643739870240.png

 

Result:

alopez222_3-1643739811381.png

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (1,771)