You are right to want one flow. Multiple flows all triggering on the same library is worse for performance than one flow with branching logic. Here is the architecture and the specific fix for each scenario.
Trigger: "When a file is created or modified (properties only)" on the library (no folder filter, covers the whole library).
Then use a Condition or Switch on the content type to branch into three paths.
Path 1 - Folder uploaded
Check: isFolder is equal to true
To delete a folder with all its contents, you cannot use the standard Delete file action. Use "Send an HTTP request to SharePoint" instead:
- Method: DELETE
- Uri: _api/web/GetFolderByServerRelativeUrl('/sites/YourSite/Shared Documents/@{triggerOutputs()?['body/{FilenameWithExtension}']}')
This deletes the folder and all its nested files and subfolders in one call.
Path 2 - Link to Site
Check: ContentTypeId starts with the ContentTypeId of your Link to Site content type (get it from the library settings URL)
Action: Update file properties
- FileLeafRef (Name) copied to Title column
Path 3 - Document
Check: isFolder is equal to false AND ContentTypeId does not start with your Link to Site type ID
Action 1: Build your concatenated COMBINED value using a Compose action
Action 2: Update file properties to set the COMBINED field
Action 3: To rename the file, use "Move file" action - same site, same library, same folder path, but change the filename to the COMBINED value while preserving the extension using:
last(split(triggerOutputs()?['body/{FilenameWithExtension}'], '.'))
to extract the extension, then append it to your COMBINED value.
One important note on the folder detection: when a user uploads a folder, SharePoint creates the folder item AND then each file inside it as separate events. The isFolder check on the first event (the folder itself) is what you catch to delete it. The child files may also trigger the flow briefly before the folder is gone. Add a short Delay (5-10 seconds) before the delete to give SharePoint time to finish creating the whole structure, then delete the parent folder in one HTTP call rather than trying to loop through children.
Best regards,
Valantis
✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.
❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).
🏷️ For follow-ups @Valantis.
📝 https://valantisond365.com/