SSIS error when copying file : File System Task Description: An error occurred with the following error message: "Cannot create a file when that file already exists. ".

nononame2021 261 Reputation points
2022-12-29T07:01:55.303+00:00

i schedule a job to run daily, normally, it run smooth without error, but sometime it will failed in copying file task in SSIS. actually, my task is moving the file from source to destination. however, I got SSIS error regarding "can't create a file which already exists". why?

I attached my SSIS screen capture.

SSIS error is as below:
File System Task Description: An error occurred with the following error message: "Cannot create a file when that file already exists. ".

anyone know how to fix it? is that i need to set "destination overwritten" to "Yes"?

274657-image.png

274698-image.png

274708-image.png

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,702 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. ZoeHui-MSFT 41,491 Reputation points
    2022-12-29T07:25:56.997+00:00

    Hi @nononame2021

    Cannot create a file when that file already exists.

    From the error message, to fix it, you may set "destination overwritten" to "True".

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.


  2. Łukasz Przyjemski 11 Reputation points
    2023-01-05T01:48:26.787+00:00

    It looks like you are using a File System Task in SSIS to copy a file from one location to another, and you are getting an error saying that the file already exists at the destination.

    One possible solution to this problem is to set the "OverwriteDestination" property of the File System Task to "True". This will cause the task to overwrite the file at the destination if it already exists.

    This should cause the File System Task to overwrite the destination file if it already exists, and should resolve the "Cannot create a file when that file already exists" error.

    If you do not want to overwrite the destination file, you can set the "OverwriteDestination" property to "False" and handle the error in a different way. For example, you could add a script task that checks for the existence of the file at the destination and handles the error appropriately.

    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.