Illegal character in path

Hi All,

Im trying to read a csv file then insert into an existing file but encountering error below.

The "*" is not a valid character in filename

1 Like

How should I fix it

Does your file has this character? Please update the “Read from file” accordingly.

If you want to search for any file in a directory with a searchPattern, use

Directory.GetFilename(myDirectory, searchPattern) to get an Array of String with full paths.

2 Likes

No, it does not contain *. I am just using it as wildcard as the filename is dynamic.

then please use the mentionned approach.

The constant word on the files is PHLPVGFW1

searchPattern = "*PHLPVGFW1*"

I dont get the myDirectory

Here it is:

myDirectory = "C:\RPADump\VPN"
searchPattern = "*PHLPVGFW1*"
firstFile = Directory.GetFilename(myDirectory, searchPattern)(0)

EDIT: or pass directly Directory.GetFilename("C:\RPADump\VPN", "*PHLPVGFW1*")(0)

1 Like