I have some files with different extensions that I need to delete. I tried to delete multiple files adding a * in the path for the Delete activity like:
“C:\Users\FINROB1\file.*”
But I get an error message.
sortIssues has thrown an exception
Message: Illegal characters in path.
When directory will be empty then it will return an error so keep that in mind and as a workaround you can handle it by using files count with if condition.
I would be tempted to use the Path.GetExtension method to determine whether or not you want to delete the file as it sounds like you only want to delete certain ones…
However, i have problem, when I add the delete activity to if window and add item as the path just as you did, it gives me an error that “object cannot be converted to string”.
I’m a newbie since a few weeks back and i still haven’t gotten the hang of all the variable type and how they work.
Would you please tell me what the solution might be to this error.
You’ve probably already figured this out, but in case others have the same result I’ll help…
In UiPath, when you create a For Each statement, the default type is Object. You have to either change the TypeArgument in properties to String, or change the item to item.toString