Exception The target file is a directory, not a file. on file.copy

ahmed salah 3,216 Reputation points
2021-05-25T06:57:49.927+00:00

I work on asp.net core 3.1 web api

I get exception error as below :

Exception The target file is a directory, not a file. on file.copy

this lines generated exception

System.IO.File.Copy(OutputfilePath, Path.Combine(exportDirectory, fileName), true);

Path.Combine(exportDirectory, fileName) is : “\\192.168.2.7\\ImportExport\\2\\Export\DeliveryGeneration_Input (69)-af650a86-ea90-40c1-86da-74f4b2c8132e.xlsx”



OutputfilePath is  : “\\192.168.2.7\\ImportExport\\2\\Export\DeliveryGenerationOutput.xlsx”

two files can access and open it when i open on fil explorer but issue

as error above

so How to solve this issue please ?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,165 questions
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.
10,247 questions
{count} votes