Moving files from one folder to another folder
Hi I have a folder which gets 3 files everyday namely, file1.xls, file2.csv and file3.xls. I need to move these 3 files to 3 seperate folders, i.e file1.xls should go to folder1, file2.csv to folder2 and file3.xls to folder3. Please let me know the best way to approach this Thanks in advance Sharath
May 27th, 2011 5:32am

Do the files and foldernames have corresponding numbers? Or do you want to configure where each file goes to?Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 5:54am

You can do this with a File system task. Depending on the naming you can use fixed values or work with variables.Axel8s http://axel8s.wordpress.com
May 27th, 2011 6:20am

Do the files and foldernames have corresponding numbers? Or do you want to configure where each file goes to? Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com Yes they have corresponding numbers. I need to configure where each file goes to. I'm new to VB scripts. So kindly let me know how I can use the script component for this
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 6:26am

Check this please http://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/503da08c-a4f1-44b2-b997-9c7bf7e0652e/ http://uk.linkedin.com/in/ramjaddu
May 27th, 2011 6:35am

An alternative for the File System Task could be a Script Task with some code: File.Move(FilePathOld, FilePathNew); But it all depends on how to determine the target folder.... Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 6:36am

The fastest way to implement this would be a script task I guess. Use the DirectoryInfo to get all the files in the folder, store the filenames in an array and loop over this array. For each file, move it to the corresponding folder. (Using File or FileInfo)MCTS, MCITP - Please mark posts as answered where appropriate.
May 27th, 2011 6:48am

Do the files and foldernames have corresponding numbers? Or do you want to configure where each file goes to? Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com Yes they have corresponding numbers. I need to configure where each file goes to. I'm new to VB scripts. So kindly let me know how I can use the script component for this A Script Task is not necessary (, but is sometimes easier). You can do the same with expressions and variables. You have to come up with an expression that can create the target folder out of the filename. For example if the filename is myFile001 and the folder is d:\folder001\, your expression will look something like "d:\folder" + LEFT([filepath],3) + "\" Now you can use that expression to fill a variable and use that variable as a target/destination folder in a File System Task. How do you read those (3?) files? Via a Foreach Loop Container?Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2011 12:38pm

Hi, There are many ways to implement. Below are simple two easy ways to implement it. Solution 1 : Step 1: Add For Each Loop to loop Source Folder ( Get the Output as File Name + File Path) Step 2: Add Script Task and Using the System.IO NameSpace Copy of move the File Solution 2: Step 1 : Add For Each Loop to loop Source Folder ( get the output File Name + File Path) Step 2: Create File Connection in connection Manager and Add Expression like If My File Name Like File Name 1 Then Set Folder Path Folder 1 Step 3: Add File System Task and Set Source Path as Variable and map the output value of For each loop and Map the Destination to File Connection which is created Step 4: Enable Delay Validation to True in Package Level Regards ========================= Naveen Kumar Thangaraj Naveen Kumar
May 27th, 2011 12:52pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics