Path name issue or problem

Peter_1985 2,711 Reputation points
2023-12-31T07:50:18.9133333+00:00

Hi,

Is this error

Exception/StackTrace - Empty path name is not legal.    at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
   at ScanFolder.Program.DirSearch(String directoryPath, String par_OutFile)223344

owing to the folder name "Program Files (x86)" below? How to ensure that we can refer to the path having one space to that?

OrigPath = "C:/Program Files (x86)/BB/Logs/";

            ```

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,287 questions
{count} votes

Accepted answer
  1. Viorel 119.7K Reputation points
    2023-12-31T09:01:09.32+00:00

    Probably the code uses a StreamWriter with an incorrect empty path. Maybe the DirSearch can be fixed or reimplemented.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 71,266 Reputation points
    2024-01-01T01:16:25.8+00:00

    unless its a typo you have an invalid path. try:

    OrigPath = "C:\\Program Files (x86)\\BB\\Logs\\";

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.