How to Copy all the files from one directory to another, and if file already exists then skip

Anjali Shah 21 Reputation points
2022-01-11T11:30:05.417+00:00

I want to copy all files from one folder to another folder. But if that file already exists in the destination folder, it should be skipped.

I did that using Foreach loop with 'OverwriteDestination'="False" but failed to skip already present file.

How shall I accomplish the same?

Any help is appreciated. Thanks.

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

Accepted answer
  1. ZoeHui-MSFT 41,496 Reputation points
    2022-01-12T02:49:27.593+00:00

    Hi @Anjali Shah ,

    You may use Script task to check if the file exists.

    And then use Foreach Loop Container and File system task to copy the files.

    Here is a detailed example you may take a reference.

    https://stackoverflow.com/questions/6598139/how-to-loop-only-through-files-that-dont-exist-in-destination-using-an-ssis-pac

    Regards,

    Zoe


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.