I would like to do the following but haven't been able to figure it out.
I want to have a condition where it's if file name equals folder name then yes (if no, no action to be taken).
In a previous flow I created a folder in library 2 when a file was uploaded in library 1 and then moved the file to the new folder (which is named the same as the file), in that folder.
Now, I want to use that folder so people can upload additional documents to it.
But I also have a flow where an item is added or updated in a list if a file is created or modified.
However, I only want an item created or updated in the list if that file has the same name as the folder.
So that no item is created for supporting documents (like e-mails) but only for the first file created in the folder which happens to have the same name as the folder.
Thanks in advance for the help!
Believe you have a document library with multiple folder names. What you want is to check whether a folder already exists in a document library using filename (Dynamic value)? Is that you looking for?
Not exactly, I do have a library with multiple folders and I want to create a flow using a condition 'if filename = foldername'. However I'm not sure if this is possible. Because I don't want the flow to work whenever a file is created or modified, only if the file happens to have the same name as the folder.
One question, if multiple files with the same name, how do you want to process it?
I have an idea that when a file upload in library A, then create it in a folder name same with the file in library B, for example:
First step should do is separate the file name and extension by using split() function, split by '.', it will get an array, the file name is the first member, so use '0' as the index to get it:
Then Get file content and create file, the folder path is Library/FileName.
Hope it could help you with something.
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I'm not sure I understand your explanation, my apologies.
I already have a flow which creates a new folder with the same name as the file and then it moves the file under that folder.
What I would need, is to create a new flow that works IF: 'when a file is created or modified' the file name equals the folder name.
Alternatively, if this is not possible, to identify the first file added to a new folder and only have that file be added to a list.
For visualisation, what I'm trying to achieve (bold I don't know how to yet)
1) a person uploads a file in library A
2) folder with name of file is created in Library B and file is moved to that folder, so that library A is empty (so it works like an upload center, without others being able to see which files are added).
3) The person has access to the folder only (not the whole library B) and can add additional files to the folder, such as supporting e-mails.
4) The original file (one with same name as folder) only is copied to a list, which is then used to create graphs. Not the additional data.
I am able to copy it to a list, but currently it copies all files instead of only the one that matters.
Ways I think it could be solved (but not sure how to execute it)
If this is not possible, I will either create a new document library for supporting documents OR not give the ability to people to add additional files in document Library B OR copy the file in two librarys (B and C) and have C be hidden and only used by owner of the SharePoint page.
I'm not sure which solution is best.
Thank you everyone!
Just to inform you I have created a work around for my case. I'll explain it shortly, in case it's useful for others as well.
Also a thank you for trying to help me figure this out!
The original goal: use a condition 'IF folder name = file name, then copy to list.
However, now I have adapted the flow as follows, I created an extra column in the document Library B (where the file was moved to under the folder). Then I added the action, change file properties, to fill out the column.
Then in a second flow I added the condition if column is not empty, then move to list.
This way only the file which was uploaded in document library A, which then using a flow moves to document library B is added to the database list. This way people can add supporting documents to the folder, but are not added to the list.
Join us for the first ever Power Platform Online Conference!
Look out for new contribution recognition badges coming SOON!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!