AnsweredAssumed Answered

How to get SharePoint folder names?

Question asked by tolbrich on Apr 16, 2018
Latest reply on Apr 16, 2018 by tolbrich

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

Outcomes