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 / Illegal characters in ...
Power Automate
Answered

Illegal characters in path

(0) ShareShare
ReportReport
Posted on by 10

Im trying to build a flow to delete files older than 550 days, but i cannot seem to even get it to delete a test file from a test folder with no conditions.

 

Get files in folder - output to variable "Files"

Delete Files - "Files"

 

Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException:

Can't delete file C:\Users\james\Desktop\Data FolderC:\Users\james\Desktop\DataFolder\76543.txt ---> System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.GetFileName(String path)
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.DeleteFileAction.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.File.Actions.DeleteFileAction.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

 

i highlighted in red the only thing i can think of that could be wong, maybe there should be a space there? i have no idea...

im pretty new to this and this is quite frustrating, if you can help, please let me know!

Categories:
I have the same question (0)
  • Verified answer
    eliotcole Profile Picture
    4,363 Moderator on at

    I think that's two paths that have been joined together, @Jlaviolette ... I might not be the person who answers this, but if you include screenshots of your flow, and maybe some example data in a code box, then folks might have a better chance of assisting you, mate. 👍

     

    Just obfuscate anything sensitive, and ensure that it's all in the original question, as that helps folks in the future parse what's going on. 🙂

     

  • Jlaviolette Profile Picture
    10 on at

    yes! so i had been putting the file path in as well as the variable and it turns out all i needed was the variable itself.
    its working now.
    now i still need to figure out how to only delete files older than 550 days

  • tsunami3775 Profile Picture
    2 on at

    My newbie tip or tip for python programmers: Don't use quotation in file path.  Or else it will cause this error.

     

    Don't use this-  "C:\Users\johnc\Desktop\test"

    Use this-   C:\Users\johnc\Desktop\test

     

    It doesn't need pythonic quotations around it or it will produce this error also.  

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard