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!
- Create a new single text line column in your library e.g. Path
- 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:
Here is what this workflow does:
- 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.
- 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)
- This step replaces filetype with /, the result of this step is /2013/05/URA//./
- Replaces “//./” with single “/”. Final result is /2013/05/URA/
- This step updates original item, column Path, with the result of previous four steps
Hope this helps!