Given path format not supported when looping through files in a directory

Hello, I got the error mentioned above as attached. the path is
“‪C:\Users\\Documents\Downloads” stored in a variable named “FromPath”. I had type argument set to String in the for each. can someone please let me know why?


Show us your entire Directory.GetFiles expression in the For Each.

What is the resulting file value shown from the file.ToString value? (By the way, .ToString isn’t necessary since the For Each has a TypeArgument of String. file is already a string)

Directory.GetFiles(FromPath) this is the expression. and attached is the path with all the files in it. thanks so much for your help again!

What is the value of FromPath? Show it from the output, don’t just assume it’s what you think it is.

It is what I typed in the default field for the variable…

This is weird, it’s such a simple thing you’re doing. I just recreated and it works fine.

Have you tried with another path? Could it be the . in the username that’s fouling it up?

Ummm, Downloads and Documents are two separate folders. Downloads is not a subfolder of Documents.

Your Downloads folder should be C:\Users\\Downloads

yea that’s probably it, I messed up with the download folder and now I can’t access it so I created another one under Documents. any way I can get this fixed? thanks

oh never mind, I just found how to restore it, will fix that and give it a try and let you know, thanks!!!

You shouldn’t mess with those folders. They’re built-in Windows folders that many things will expect to be there. If you can’t access a folder, your local permissions should be reviewed.

I fixed the downloads folder, but still got the same message. I then tried a different folder on my desktop, and got the same message! any idea what else could cause this?

It’s so weird, I used select folder activity to pass the folder path and it works, but I can’t tell any difference from that path and the one I entered in the variable. I still need to figure out how to do this directly without having to use select folder, it’s just so inconvenient. Does anyone know why this happened?

What is the datatype of FromPath? I wonder if your UiPath is installed as a user that doesn’t have access to your folders. Try a simple path like “C:\temp”


I wonder if the user UiPath is running as doesn’t have permissions to user folders. Try something basic like “C:\temp”

tried “C:temp”, still the same error message. for now I resort to VBA, I have the VBA code in a workbook and used execute macro to manipulate the files…

maybe it has something to do with security, I’m using work computer and there are multiple layers of security built in. Paul you are awesome I really really appreciate your time!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.