I am trying to have the existing files names to be renamed to a new file names by using an excel file.
Invoke code as follows:
FileIO.FileSystem.RenameFile(oldFileName, newFileName)
Screenshot as follows:
Appreciate the help in advance!
I am trying to have the existing files names to be renamed to a new file names by using an excel file.
Invoke code as follows:
FileIO.FileSystem.RenameFile(oldFileName, newFileName)
Screenshot as follows:
Appreciate the help in advance!
Hi,
Can you share content of $exceptionDetails at Locals panel when error occurs in debug mode?
Regards,
Hi,
Can you share value of $exceptionDetails as text? We cannot see it from the above image.
Regards,
Hi @Yoichi , my apologies.
Text as it is:
RemoteException wrapping System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> RemoteException wrapping System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) at System.IO.Path.Combine(String path1, String path2) at Microsoft.VisualBasic.FileIO.FileSystem.GetFullPathFromNewName(String Path, String NewName, String ArgumentName) at Microsoft.VisualBasic.FileIO.FileSystem.RenameFile(String file, String newName) at UiPathCodeRunner_fe840df6108e488a82dcc7de1e1cd516.Run(String oldFileName, String newFileName)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object providedArgs, ParameterModifier modifiers, CultureInfo culture, String namedParams) at UiPath.Activities.System.Utilities.InvokeCode.CompilerRunner.Run(Object args) at UiPath.Activities.System.Utilities.InvokeCode.NetCodeInvoker.Run(String userCode, List1 inArgs, IEnumerable
1 imps, Object args) at UiPath.Core.Activities.InvokeCode.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Hi @Sudharsan_Ka , i did download the attachment and replace the code as well. it is still throwing out the error.
Hi,
This message shows there is illegal character in your file path.
Please check if there is illegal character such as
Regards,
Hi @Justine
Could you please share the Invoice.xlsx screenshot or the file itself.
I cannot find the value for newFileName in the screenshot but i think “_” may be replaced with “|” pipe symbol.
Hi @johnfelix ,
attaching the file for your reference
Invoices.xlsx (7.4 KB)
Hi @Justine
newFileName column contains value with linebreak and that’s also an illegal character.
you can replace the new break in the newFileName before passing it to argument
try below code to replace the line break
row(“newFileName”).ToString.Replace(vbLf,“”)
Also you can give a try with Rename File activity to achieve same result.
If you use this activity, then no need to replace the line break. activity itself will handle the line break
Thanks
John
i tried to include the replace function, somehow it still didn’t remove the additional line break.
(item(“Account No”).tostring+“_”+item(“Invoice Number”).tostring+“.pdf”).Replace(vbLf,“”)
i tried to remove the additional line break manually and execute the bot again, the error still persist.
Why don’t you just use activities, like For Each File in Folder, and Move (to rename)?
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.