Monday, March 26, 2012

how to Archive the Flat files after they are loaded into a directory

I have to archive the Flat files after they are loaded into an archive folder with a Date time stamp on the folder in the format mmddyyyyhhmmss what task should i use in ssis to complete this and can i do this task for multiple files in the directory, how should i configure such that all files are archived and placed in one directory with a current timestamp, Please Provide me with a solution

Dev2624 wrote:

I have to archive the Flat files after they are loaded into an archive folder with a Date time stamp on the folder in the format mmddyyyyhhmmss what task should i use in ssis to complete this and can i do this task for multiple files in the directory, how should i configure such that all files are archived and placed in one directory with a current timestamp, Please Provide me with a solution

Use the FileSystem Task. You should also look into the MULTIFILE connection manager. See if these do what you want and if you have any problems, reply here.

-Jamie

|||

I am sorry if i had confused with my topic but what i want to do is once i load the Flat file into the dimension i want to archive that file in another directory with the current date time stamp. Please provide me the solution using ssis.

ex: source file abc.txt

i want to archive as abcmm/dd/yyyy.txt in archive folder say folderarchive

|||

I think Jamie pointed you in the right direction. See if this example takes you further:

http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html

|||

Dev2624 wrote:

I am sorry if i had confused with my topic but what i want to do is once i load the Flat file into the dimension i want to archive that file in another directory with the current date time stamp. Please provide me the solution using ssis.

ex: source file abc.txt

i want to archive as abcmm/dd/yyyy.txt in archive folder say folderarchive

I perfectly understand what you want to do and I am trying to help you. What I am NOT going to do is write the solution for you.

Have you identified that the FileSystem task can be used to move files? Hopefully you have. if you want to change the name of the file when you move it then use expressions.

This should particularly help:

Setting expressions

(http://blogs.conchango.com/jamiethomson/archive/2006/03/11/SSIS-Nugget_3A00_-Setting-expressions.aspx)

As might this:

Searching for "FileSystem" on the SSIS search macro

(http://search.live.com/results.aspx?FORM=QBJK&q1=macro%3Ajamiet.ssis&q=filesystem or http://search.live.com/results.aspx?q=file+system&form=QBRE&q1=macro%3Ajamiet.ssis)

Rafael also has a very good post on it:

File System Task Move and rename files in one step

(http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html)

-Jamie

|||

Jamie Thomson wrote:

Rafael also has a very good post on it:

File System Task Move and rename files in one step

(http://rafael-salas.blogspot.com/2007/03/ssis-file-system-task-move-and-rename.html)

As you now know seeing as he beat me to a reply Smile

|||

Thanks for the quick responses , both the links provided me an insight i will be working on it and let both know about any further issues. Thanks for the response

|||

I was able to do that thanks for the help but i have one more thing ahead is that i have to rename the file using a value taken from the header row in the file. Do i need to use a global variable and capture header into that.

I am a newbie and your direction is encouraging i also need your guidance in checking whether a list of files exist in the directory or not how can i acheive that , i used scripting task to check for whether a single file exists but how to check for multiple files , is there a way we can configure the scripting task to check for list of files.

Please guide me

|||

If you need a data element that inside of the file; you can use an script task to get it.

There are several ways to check if a file already exists. If you already have an script task that check for 1 file; you could embed it in a ForEachLoop with a File enumerator to loop through all files in a directory.

No comments:

Post a Comment