web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Getting a "/" between ...
Power Automate
Suggested Answer

Getting a "/" between Folder Path and File Name

(2) ShareShare
ReportReport
Posted on by 11
I've used Power Automate to copy content that is updated in a SharePoint Library to a file share for many years.  But it started to fail recently.  I thought it was because the gateway needed to be updated but that has been done now and I'm still having issues.
 
The original flow looked like this.
 
But when I run that now I and up with a '//" between the Folderpath and the filename.
 
I've tried several things to get rid of the slashes  such as removing the folder path and replacing it with first(split(triggerOutputs()?['body/{Path}'],'/')).  That gets rid of the first "/" but not the second one.  I end up with this:
 
However, this looks correct.  So where is the "/" between the path and the filename coming from and HOW DO I GET RID OF IT?
Categories:
I have the same question (0)
  • Suggested answer
    11manish Profile Picture
    3,333 on at
    The safest fix is to:
    • Inspect the actual runtime values using Compose.
    • Remove any trailing / from the Folder Path using trimEnd() (or equivalent).
    • Let the File System connector append the separator itself.
    In most cases, this resolves the // issue immediately.
  • Suggested answer
    Valantis Profile Picture
    6,735 on at
     
    The double slash happens because the Folder Path value now includes a trailing slash AND you're adding another slash as a separator when concatenating with the filename. This is a common issue after SharePoint connector updates that changed how the {Path} value is returned.
     
    The fix: use trimEnd to strip the trailing slash from the folder path before concatenating:
    concat(trimEnd(triggerOutputs()?['body/{FolderPath}'], '/'), '/', triggerOutputs()?['body/{Name}'])
     
    Or if you're building the path manually:
    concat(triggerOutputs()?['body/{FolderPath}'], triggerOutputs()?['body/{Name}'])
    without adding a '/' in between at all if the FolderPath already ends with a slash, just append the filename directly.
     
    To diagnose exactly what's in each value, add two Compose actions before your file action:
    - Compose 1: triggerOutputs()?['body/{FolderPath}']
    - Compose 2: triggerOutputs()?['body/{Name}']
     
    Check the run history outputs of those Compose actions to see if the trailing slash is in FolderPath or if it's being added elsewhere in your expression.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

  • Suggested answer
    chiaraalina Profile Picture
    2,425 Super User 2026 Season 1 on at
     
    Add a Compose action step between:
     
    concat(
      '\\server\30\Buildings\SharePoint\Safety-Rensselaer\',
      replace(
        substring(triggerOutputs()?['body/{Path}'], 0, sub(length(triggerOutputs()?['body/{Path}']), 1)),
        '/',
        '\'
      )
    )
     
    Hope it helps! Let me know if it worked!
  • Suggested answer
    Haque Profile Picture
    3,653 on at
    Hi @forbesn,
     
    Your attempt to use first(split(triggerOutputs()?['body/{Path}'],'/')) removes the first slash segment but doesn’t address trailing or leading slashes properly, which is why you still see the second slash.
     
     
    Trim trailing slash from Folder Path: Use an expression to remove any trailing slash from the Folder Path, for example:
    if(
      endsWith(triggerOutputs()?['body/{Path}'], '/'),
      substring(triggerOutputs()?['body/{Path}'], 0, sub(length(triggerOutputs()?['body/{Path}']), 1)),
      triggerOutputs()?['body/{Path}']
    )
    
    Trim leading slash from File Name: Similarly, ensure the File Name does not start with a slash:
     
    if(
      startsWith(triggerOutputs()?['body/{FilenameWithExtension}'], '/'),
      substring(triggerOutputs()?['body/{FilenameWithExtension}'], 1, sub(length(triggerOutputs()?['body/{FilenameWithExtension}']), 1)),
      triggerOutputs()?['body/{FilenameWithExtension}']
    )
    
     
    Concatenate with a single slash: Then combine them explicitly with one slash:
    concat(
      <trimmedFolderPath>,
      '/',
      <trimmedFileName>
    )
    
     

    I am sure some clues I tried to give. If these clues help to resolve the issue brought you by here, please don't forget to check the box Does this answer your question? At the same time, I am pretty sure you have liked the response!
     
     
  • Suggested answer
    RaghavMishra Profile Picture
    261 on at

    Hi there,

    That extra slash is a classic concatenation issue, and it's fixable with one expression. Here's what's happening and the cleanest way to remove it.

    Where the second "/" comes from

    You're ending up with // because the value now already ends in a slash, and then a separator slash is being added again when it's joined to the file name - so you get one from the path and one from the join. Your first(split(...,'/')) attempt only trims one segment, which is why a slash still slips through.

    The simplest fix - collapse the double slash

    Rather than trying to trim the exact right end, build the full path and then replace any // with a single /:

    replace(concat(<folderpath>, '/', <filename>), '//', '/')

    replace() returns the original string if the substring isn't found, so this is safe even when there's no double slash - it just normalizes the result either way.

    One thing to watch out for

    trimEnd() isn't available as a workflow expression function in Power Automate, so an expression built around it will error out. Also note trim() only removes leading/trailing whitespace - not a / character - so it won't strip the slash on its own.

    Alternative - trim the trailing slash explicitly

    If you'd rather remove the slash before joining, this pattern works with supported functions:

    if(endsWith(<folderpath>, '/'), substring(<folderpath>, 0, sub(length(<folderpath>), 1)), <folderpath>)

    Then concatenate with a single / separator. Either approach gives a clean single-slash path. A quick Compose action showing the raw value is handy to confirm the trailing slash before and after.

    References:

    Found this helpful? Please mark ✅ "Does this answer your question?" so others searching for the same issue can find it quickly. A 👍 on "Was this reply helpful?" or a ♥ Like is also much appreciated!

    Raghav Mishra - LinkedIn | PowerAI Labs

  • forbesn Profile Picture
    11 on at
    Thank you  and  for your posts.  Those were helpful but no matter what I do, the Create File step is adding the "/" into the path somehow.
     
    I have added variables to store the values I use from Get file Content step.
     
    For the folder variable I just assign a string value of " \\{DFS domain}\30\Buildings\SharePoint\Safety-Rensselaer\"
    Outputs = 
    {
      "variables": [
        {
          "name""Folder",
          "type""String",
          "value""\\\\{DFS domain}\\30\\Buildings\\SharePoint\\Safety-Rensselaer\\"
        }
     
    The compose did help me verify that triggerOutputs()?['body/{Path}' = "JHA/" - so I assigned the following formula to a variable to strip out the "/" at the end.
     
    if(endsWith(triggerOutputs()?['body/{Path}'], '/'), substring(triggerOutputs()?['body/{Path}'], 0, sub(length(triggerOutputs()?['body/{Path}']), 1)), triggerOutputs()?['body/{Path}'])
     
    (This variable will contain the SharePoint library name plus any additional folders under it where the file might exist.)
     
    {
      "variables": [
        {
          "name""FolderPath",
          "type""String",
          "value""JHA"
        }
      ]
    }
     
    The FullFolder variable concatenates the two variables.  (I've tried that way, plus appending a single slash and a double slash, ie '\' or '\\').  It appears to need the single slash though.
    Expression:  concat(variables('Folder'),variables('FolderPath'),'\')
    {
      "variables": [
        {
          "name""FullFolder",
          "type""String",
          "value""\\\\chiefind.net\\30\\Buildings\\SharePoint\\Safety-Rensselaer\\JHA\\"
        }
      ]
    }
    The variable for Filename is the Filename with Extension Value from the Get File
    {
      "variables": [
        {
          "name""filename",
          "type""String",
          "value""TestNancy.docx"
        }
      ]
    }
     
    The Create File now looks like this 
    and has these results
     
    Which look correct to me but it still adds the "/" between the FullFolder Value and filename value.
     
        "message""The requested action could not be completed. Check your request parameters to make sure the path '\\\\{DFS domain}\\30\\Buildings\\SharePoint\\Safety-Rensselaer\\JHA\\/TestNancy.docx' exists on your file system."
      },
     
    Where is that "/" coming from?
     
    I added a compose for the {File Name with Extension} and all that shows is "TestNancy.docx". I don't see any leading slashes. Even so, I tried assigning this expression to my Filename Variable:  (The purpose to remove any leading "/" in the filename  (even though one isn't visible.)
    if(startsWith(triggerOutputs()?['body/{FilenameWithExtension}'], '/'), substring(triggerOutputs()?['body/{FilenameWithExtension}'], 1, sub(length(triggerOutputs()?['body/{FilenameWithExtension}']), 1)), triggerOutputs()?['body/{FilenameWithExtension}'] )
     
    That didn't make any difference.
     
    As for the "FullFolder" variable.  I have tried the following options on the concat:
    1. Not appending any slash and the end result is ..\JHA/TestNancy.docx
    2. Appending a single slash and the result is ..\JHA\/TestNancy.docx
    3. Appending a double slash and the result is ..\JHA\\/TestNancy.docx.

     
     
     
  • Suggested answer
    chiaraalina Profile Picture
    2,425 Super User 2026 Season 1 on at
     
    I think that extra / is being inserted by the File System / Create file action.
     
     
    FullFolder should end as : ......30\Buildings\SharePoint\Safety-Rensselaer\JHA and not ....30\Buildings\SharePoint\Safety-Rensselaer\JHA\

    Remove the final slash to FullFolder and then try again. 
     
    Still keep filename as TestNancy.docx.
     
    Let me know if it worked!
     
     
  • forbesn Profile Picture
    11 on at
    Chiaraalina, please note in the last post I tried that.
     
    As for the "FullFolder" variable.  I have tried the following options on the concat:
    1. Not appending any slash and the end result is ..\JHA/TestNancy.docx
    2. Appending a single slash and the result is ..\JHA\/TestNancy.docx
    3. Appending a double slash and the result is ..\JHA\\/TestNancy.docx.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 377

#2
11manish Profile Picture

11manish 279

#3
David_MA Profile Picture

David_MA 234 Super User 2026 Season 1

Last 30 days Overall leaderboard