File System Task

  • Afternoon,

    This may seem something very simple for others, but i'm struggling as i new to ssis. so sorry if i have offended

    I have a directory "D:\Downloaded Files\" That is static. What i what to be able to do is create a directory inside of that with the date when ever the ssis package runs.

    So if the job ran today it would create a directory like this D:\Downloaded Files\20080919\

    Any help would be great.

  • In your file connection you can use expression to generate the folder name.

    Expression- > connection String - > Use following expression

    "D:\\Downloaded Files\\" +

    (DT_WSTR, 4) DATEPART( "yy", getdate()) +

    RIGHT("00" + (DT_WSTR, 4) DATEPART( "mm", getdate()),2) +

    RIGHT("00" + (DT_WSTR, 4) DATEPART( "dd", getdate()),2)

    HTH

    ~Mukti

  • Ummm... will that create the sub-directory if it doesn't already exist?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • I think i didin;t think through properly. The way to do this will be to have a variable that will generate the file name

    "C:\\"+

    (DT_WSTR, 4) DATEPART( "yy", getdate()) +

    RIGHT("00" + (DT_WSTR, 4) DATEPART( "mm", getdate()),2) +

    RIGHT("00" + (DT_WSTR, 4) DATEPART( "dd", getdate()),2)

    Then use the variable as source in File System task to create the folder.

    You can set the UseDirectoryIfExists property in File system Task editor according to your requirement.

  • Still, will that create a directory that doesn't already exist?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • No, the file connection will not create the directory if it does not exist. You do that in a File System Task using the create directory operation. This is also where you can set the UseDirectoryIfExists option based on your needs.

    We do this to archive files we transfer to a Managed Service Provider.

    😎

  • Lynn Pettis (9/22/2008)


    No, the file connection will not create the directory if it does not exist. You do that in a File System Task using the create directory operation. This is also where you can set the UseDirectoryIfExists option based on your needs.

    We do this to archive files we transfer to a Managed Service Provider.

    😎

    Thanks Lynn.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 7 posts - 1 through 6 (of 6 total)

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