Hi Community,
I’m looking for help building a Power Automate flow that reads documents from a SharePoint document library and creates one SharePoint list item per document.
1) Folder structure (fixed depth)
In my SharePoint document library, the structure is always:
- Root folder
- Customer 1
- Document A
- Document B
- Document C
- Archive
- Archive Document 1
- Customer 2
- Documents …
- Customer 1
The depth is always: Root → Customer → (optional Archive) → Files
I want to process files only (documents), not folders.
For each file, create a SharePoint list item with:
- The list’s Title column (renamed to “Customer” in the UI) should be the customer folder name, not the file name.
- If the file is directly inside the folder "
Customer 1", Title should be: "Customer 1" - If the file is inside "
Customer 1/Archive", Title should be: "Customer 1_Archive"
- If the file is directly inside the folder "
- The actual document file name in the library should not be changed (only the list item Title).
My flow currently looks like this:
- Manually trigger a flow
- Get files (properties only) (SharePoint)
- Filter array:
IsFolderequalsfalse - Apply to each
- Create item (SharePoint list)
I tried to set the Title directly via an expression that extracts the parent folder name from FileDirRef (or FileRef) and appends _Archive when the path contains /Archive but its always null the value I’m using (e.g., item()?['FileDirRef'] or item()?['FileRef']) is null, even though I expected only file items.
So what is the best/robust approach to ensure the loop processes files only (no folders), and renames them as the foldername they are in
I attached screenshots of the folder structure and the current flow configuration
Thanks a lot in advance!

Report
All responses (
Answers (