iterate files while copying.

  • Hi All,

    I am having source and destination folders.I want to just copy files from source to destination.

    But while copying i need to fetch files names from table.

    for example: Select FileName from mytable. IF the output FileName from query matches with the FIlenAme in source folder then i want to copy that file. How can I do this?

    Any sample package or any clue please.......

    Thanks

    Abhas

  • I'd use a Script Task:

    1) Read file names from table into an array.

    2) For each array element:

    a) perform the file-existence check:

    i) If true, copy the file

    ii) If false, go to next array element

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Thanks Phil,

    Could you please share sample or design?

    Thanks

    Abhas

  • That is the design.

    I'm not going to write the code for you - there are lots of C# loop and copy file examples on-line.

    Please have an attempt and then come back here with any specific questions you encounter while developing.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Thanks,

    I tried as below:

    First execute sql task, Fetching file names and storing into variable here.

    After i am using for each loop container. in that using script task. but not able to assign file name which i want to copy to variable in script task.

    If anybody has idea then please let me know.

    Thanks

    Abhas.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply