cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

How to get SharePoint folder names?

Jump to solution

Hello community,

we have a SharePoint library with a folder structure 4 levels deep.

I need to get all folder names of a document in separate variables.

Once I have the folder names the workflow adds a link to the document in a second list along with the modified date of the document. This list has a view that can be grouped by the folder names and is sorted by modified date in descending order. It should give our users quick access to the latest modified files in the document library.

The complete URL looks like:

<WebURL>/libraryname/folder1/folder1-2/folder1-2-1/folder1-2-1-1/filename.ext

When I use the following RegEx

Pattern:    [^/]+$

Operation: Replace Text

Replacement Text:

Input Text: fn-Replace({Common:ItemUrl},{Common:WebUrl},"")

the remaining string is:

/libraryname/folder1/folder1-2/folder1-2-1/folder1-2-1-1/

Now I need the folders in variables like:

Folder1 = folder1

Folder2 = folder1-2

Folder3 = folder1-2-1

Folder4 = folder1-2-1-1

So far I was not able to find the RegEx patterns to achieve this.

I would be very happy if someone here already solved this problem or has a good knowledge about RegEx to solve it.

Thank you very much in advance.

Thomas

0 Kudos
Reply
2 Replies
Workflow Hero
Workflow Hero

Re: How to get SharePoint folder names?

Jump to solution

Hello Marian,

Thank you for your answer. This looks like it would exactly solve my problem.

I am going to test this and mark it as correct answer then.

Best Regards

Thomas

Reply