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
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’
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.
I checked your file and found there is 0-width special character : U+202A (0xE280AA in UTF8) b/w double quote and C.
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.)
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
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
If you want to delete all the file sin the folder why not use delete folder activity directly and recreate it?