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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Renaming PDF based on ...
Power Automate
Unanswered

Renaming PDF based on File Text

(0) ShareShare
ReportReport
Posted on by 13

Hi! Super new to Power Automate, and I'm having some trouble.

I have PDF files that are exported from a software that produces a standard name based on the data from the software, OrdeType LastnameFirstname OrderLocation. I need each of the files to be renamed using a specific string of text OrderNumber in the PDF. I'm having an issue getting it to actually rename the file. It's pulling all the correct info to the assigned variables, it just won't perform the action. It tells me that there's an illegal character in the path, but I can't figure out what it's referring to. The files are stored locally on a Desktop subfolder, not in OneDrive or SharePoint.

 

Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Can't rename file ---> System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.Combine(String path1, String path2)
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.RenameFilesAction.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.RenameFilesAction.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

  

Categories:
I have the same question (0)
  • wskinnermctc Profile Picture
    6,519 Moderator on at

    You probably need to check for special characters that are considered Reserved or Invalid and lots of times it will end up being a backslash \ from a path name. It could also be the colon : or a leading space getting pulled into the name.

     

     

    wskinnermctc_0-1675116944517.png

     

     

    https://support.microsoft.com/en-us/office/restrictions-and-limitations-in-onedrive-and-sharepoint-64883a5d-228e-48f5-b3d2-eb39e07630fa#invalidcharacters 

  • awashington Profile Picture
    13 on at

    How do I fix that? I tried to see if using CurrentItem.Name would fix that issue, but now it just tells me "File to rename not found".

    awashington_0-1675117757926.png

    Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: File to rename not found ---> System.IO.FileNotFoundException: Could not find file 'C:\Program Files\WindowsApps\Microsoft.PowerAutomateDesktop_10.0.5656.0_x64__8wekyb3d8bbwe\Name.pdf'.
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.File.InternalMove(String sourceFileName, String destFileName, Boolean checkHost)
    at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.RenameFilesAction.Execute(ActionContext context)
    --- End of inner exception stack trace ---
    at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.RenameFilesAction.Execute(ActionContext context)
    at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)
  • Verified answer
    awashington Profile Picture
    13 on at

    Figured it out!

    awashington_0-1675180215779.png

     

  • PedroNL Profile Picture
    30 on at

    I am having the same issue... 

     

     

    My CurrentItem.Name = 1099NEC (100).pdf

     

    The new Name "TextReplaced" = FileLLC

     

    See the attached screen shot.

     

    PedroNL_0-1706106125149.png

     

     

    Here are my error details:

    Correlation Id: c66de207-190f-497f-97be-b99b0b15b599

    Illegal characters in path.: Microsoft.PowerPlatform.PowerAutomate.Desktop.Actions.SDK.ActionException: Can't rename file ---> System.ArgumentException: Illegal characters in path.
    at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
    at System.IO.Path.Combine(String path1, String path2)
    at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.RenameFilesAction.Execute(ActionContext context)
    --- End of inner exception stack trace ---
    at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.RenameFilesAction.Execute(ActionContext context)
    at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

     

     

    This is for a local PDF what do you say that I do to fix this?

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard