Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Read folder attach to email and move

Author  Topic 

rwaldron
Posting Yak Master

131 Posts

Posted - 2009-08-10 : 10:52:39
Hi all..
Yep this sounds easy enough but I am having trouble..SSIS
I want to read files from a folder eg ord123 (no file ext.)
For each file found I want to attach it to an email and send
I then want to move the file to another location.
So in SSIS I added a For each loop container.
In the collection of the For each loop I set my target folder and set files to ord*.I then tick retrieve fully qualified filename.
I have a variable created called FileWeJustFound.
I add a send mail task.
In expressions I use FileAttachements = @[User::FileWeJustFound]
When I test this it works great..Each file found gets emailed to an address....
My problem is ..Now I want to move the file from its current folder to another folder.
So I use a File System task..But I now need to use this with ANOTHER For each loop ?
I'm just confused about how I know move the file to another folder.
Is this now a nested for each loop I need.
Please help..
Ray..

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-08-12 : 13:11:01
You don't need another loop.

Add the FileSytem Task into the first loop, after the email task. Use @[User::FileWeJustFound] as the SourceFileName in the FileSytem task.
Go to Top of Page
   

- Advertisement -