j8zel
(JKL)
August 22, 2023, 3:09am
1
Hi, I just converted a project from Windows Legacy to Windows. For some reason, the files all end up with Nul at the end of their name when they didn’t previously in Legacy.
The automation is unable to copy the files from the Directory and throws an error msg which prompted me to find out why it’s happening
Error Message
How do I fix this please? TIA
Variables
currMyFiles =
files =
Activity
Windows Output export
Window Legacy Output exported
Yoichi
(Yoichi)
August 22, 2023, 3:29am
2
Hi,
As a workaround, can you try the following expression? This will remove 0x00 character at the end of the string.
Directory.GetFiles(currMyFiles).Select(Function(f) f.TrimEnd(Chr(0))).ToArray()
Is Z drive network drive? There might be cause for this.
Regards,
j8zel
(JKL)
August 22, 2023, 3:31am
3
Thank you. Yeah Z drive is a mapped network drive
Yoichi
(Yoichi)
August 22, 2023, 3:44am
4
Hi,
Similar issue is reported in the following. It may be a bug of .net5/6.
opened 03:01AM - 06 Jan 21 UTC
closed 02:56PM - 28 Jun 22 UTC
area-System.IO
When .net core system.io Directory.GetFiles() operates \\\\xxx.xx.xx.x@88\\DavWW… WRoot\\Doclib, there will be an extra'\0' at the end of the file path string, such as "\\\\xxx .xx.xx.x@88\\DavWWWRoot\\DocLib\\TeamViewer_Setup.exe1\0", and then use File.ReadAllBytes() to read content and an error occurred: System.ArgumentException:“Illegal characters in path. ”, but this will not happen in the .net framework.
Regards,
1 Like
Anil_G
(Anil Gorthi)
August 22, 2023, 3:48am
5
@j8zel
Try using path.Combine(myFolder,Now.Year.ToString)
Cheers
j8zel
(JKL)
August 22, 2023, 11:16am
6
Thank you Anil. I have added your suggestion.
1 Like
j8zel
(JKL)
August 22, 2023, 11:18am
7
Thanks Yoichi! I was able to run my automation based on your coding. I also read the link you sent. Very informative. Cheers!
system
(system)
Closed
August 25, 2023, 11:18am
8
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.