I recently created a view in a document library that shows files modified in the last 30 days. We use a number of levels (folders) in this document library so I wanted to indicate in which folder a modified file was stored.

Here is how you can do this. This is an overkill for task as simple as this one, but it only solution I could think of. It works!

  1. Create a new single text line column in your library e.g. Path
  2. Fire up SharePoint Designer (2010 or 2013) and create a new List Workflow that fires when item is created

Here is how your workflow activities should look like:

Workflow Activities

 

Here is what this workflow does:

  1. Copies value from a hidden column Server Relative URL to a variable substring. Please note: we are omitting first 35 characters. These 35 leading characters are path to the document library and you will need to change this number to match your environment. In my case full Server Relative URL looks like this: /finance/invoices/Shared Documents/2013/05/URA/TeamViewer_552075866.pdf
    In this example step stores /2013/05/URA/TeamViewer_552075866.pdf to the substring variable.
  2. This step removes original filename from string. In my case result of this step is /2013/05/URA//.pdf (Please note: I have no idea how to replace something with an empty string in SharePoint Designer, so I am using “/” instead)
  3. This step replaces filetype with /, the result of this step is /2013/05/URA//./
  4. Replaces “//./” with single “/”. Final result is /2013/05/URA/
  5. This step updates original item, column Path, with the result of previous four steps

Hope this helps!

One Comment

  1. Matt Says

    Am I missing something? I can’t find the replace function from the middle 3 steps. Anywhere I should be looking?

Leave a Reply