SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 ForEach Loop is Not Trapping File Name
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jbates99
Constraint Violating Yak Guru

362 Posts

Posted - 02/06/2013 :  23:59:15  Show Profile  Reply with Quote
Hi all,
This should be a very easy thing to do in SSIS 2008 but I'm having problems.

I just want to loop thru all .txt files in C:\Source and MOVE each file to C:\Archive folder.

I have a ForEach Loop and a File System Task. When I run it, it fails in the File System task with error "Could not find file 'C:\Source\'

Notice the filename is missing so I need help to populate the file name. Do I do this in the ForEach Loop's Collection or a variable?

Thanks, Jack

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 02/07/2013 :  00:05:13  Show Profile  Reply with Quote
you need to add a variable and map it inside ForEachLoop to get value during each iteration.

You need to select an appropriate property in For Each Loop (filename only, filename with extension, fully qualified) to get value in required format

see these examples

http://visakhm.blogspot.in/2012/05/package-to-implement-daily-processing.html
http://visakhm.blogspot.in/2012/12/selective-file-archiving-using-ssis.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

jbates99
Constraint Violating Yak Guru

362 Posts

Posted - 02/12/2013 :  17:24:06  Show Profile  Reply with Quote
Thank you, visakh16. This worked
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52309 Posts

Posted - 02/13/2013 :  04:45:52  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000