Error while using get file function in uipath

Hi everyone!

I wanted to delete all the files from a folder using get files function with the help of for each activity but it’s showing folder path twice as shown in the attached screenshot

Download folder path: “‪C:\Users\Turtlemint\Downloads”

But while running process it’s throwing error:
For Each: The filename, directory name, or volume label syntax is incorrect. : ‘C:\Users\Turtlemint\Documents\UiPath\RoboticEnterpriseFramework1\‪‪C:\Users\Turtlemint\Downloads’

Please help, Thanks in advance.

hi! look at this ‘C:\Users\Turtlemint\Documents\UiPath\RoboticEnterpriseFramework1\‪‪C:\Users\Turtlemint\Downloads’

\‪‪C:\Users\Turtlemint\Downloadsyou you folder is inside c…documents…framework and inside framework is C…downloads?

show us this full line
image

Full line in get files function showed in below screenshot

Hi @Afzal_S

Assign folderPath = “C:\Users\Turtlemint\Downloads”

Assign fileList = Directory.GetFiles(folderPath)

For Each file In fileList
Delete File (file)
End For Each

Hope it helps!!

Hi @pravallikapaluri,

Same issue please check below screenshot.

HI,

Can you share your xaml file?

Regards,

Can you share your xaml file once

Please find the below zip file. @Yoichi @pravallikapaluri

RoboticEnterpriseFramework1.zip (950.9 KB)

Hi @Afzal_S

Check the Input folder path once, Might be there is no existence of the Path or the path should be wrong. I have used my local path and it is successfully runned.Check the below img.

Hi,

I checked your file and found there is 0-width special character : U+202A (0xE280AA in UTF8) b/w double quote and C.

image

image

So, can you try to remove this character? We can identify it to press right key 2 or 3 times from the beginning of the string. (There is position which cursor doesn’t move even if press right.)

Regards,

Hi @Afzal_S ,

Use below code snippet For Download File Path::
System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), “Downloads”)

And To get files For The folder Use::
Directory.GetFiles(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), “Downloads”)) in ForEach Activity

Hope it helps!!

@Afzal_S

Two thing shere

  1. You can use for each file in folder activity directly instead of using for each activity with directory.getfiles and currentfile.FullName will give the path
  2. If you want to delete all the file sin the folder why not use delete folder activity directly and recreate it?

Hope this helps

Cheers

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