how to copy for a file in sub directories basing on the file name in ssis

  • How to copy a particular file from sub folders basing on the file name. I have multiple sub folders and the file which i am looking for may present in the sub folder level or it may be present in another sub folders under the present sub folder. can any of you guys help me in this

  • My suggestion...

    Drag a ForEach Loop container onto the Workflow tab

    Drag a FileSystem task into the ForEach Loop container

    Configure the ForEach Loop container as follows:

    On the General tab...

    - Name the task appropriately

    On the Collection tab...

    - Specify the Enumerator type...in your case "For Each File"

    - Specify the (Parent) Folder path

    - Provide the file name and extension attributes ( *.txt, myfile*.txt, etc)

    - Specify how you want the file name returned. If you want to keep it simple then return the fully qualified file name which includes the file system path

    - Specify if you want to search all subfolders

    On the Variable Mapping tab..

    - Click in the Variable box and select New Variable. Name it FQFileName.

    - Set the data type to String

    Exit Edit on the ForEach Loop Container

    Configure the FileSystem task:

    On the General tab...

    - Set the Destination connection as needed...in your case it should be a folder...existing or create

    - Specify whether to Overwrite or not

    - Set the operation to Copy File

    - Set the Is Source Path Variable to True

    - Set the Source Variable to User::FQFileName from the dropdown list

    When you execute the package it will find all files that match the source name pattern you provided in the folder structure you specified and copy them into the destination folder you specified.

    HTH

    MReed

    Pragmatic Works

  • Thanks a lot for your help. Struggled for a day with this. But looks very simple and clear.

Viewing 3 posts - 1 through 2 (of 2 total)

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