Looping and File names

Who is online?  0 guests and 0 members
Home  »  Forums   »  microsoft business intelligence   »  integration services   » Looping and File names

Looping and File names

Topic RSS Feed

Posts under the topic: Looping and File names

Posted: 2/7/2012

Jedi Youngling 16  points  Jedi Youngling
  • Joined on: 6/25/2010
  • Posts: 8

2 files are delivered encrypted to delivery_folder.

I have created a for-each loop to pick up all files in the folder (*.pgp) and copy them to an archive folder.

I then need to decrypt each file and give each file a specific name.

files come into delivery_folder named file_name02012012.txt.pgg and file_name102012012.txt.pgp

after the copy to the archive folder, i want to decrypt the files in the delivery_folder to file_name.txt and file_name1.txt

I was attempting to do the move AND the decrypt step within one ForEachLoop container. Not working...please advise.

 

 


Posted: 2/7/2012

Padawan 1437  points  Padawan
  • Joined on: 3/24/2010
  • Posts: 196

I do that ( though not in a LOOP ) with my present employer.  Can you provide a few more pieces of information?

  • What version of SQL Server are you running?  Is is 32 or 64 bit SQL? 
  • What is the operating system on which you're running this process?
  • Are you using only stock components in the SSIS package or do you have some 3rd party pieces as well?
  • What is the error message that you're getting when the package fails?

Hope to hear from you,

Keith

 

 


Posted: 2/7/2012

Jedi Youngling 16  points  Jedi Youngling
  • Joined on: 6/25/2010
  • Posts: 8

Right now I am upgrading DTS pkgs to SSIS, I am running SSIS against a SQL Server 2000 backend. Going to SQL Server 2008 64 BIT.

No 3rd party software.

I apologize for an unclear explanation - I am new to SSIS.

In my ForEachLoop container I populate a variable filename.

Files are copied to Archive directory - successful.

 

DECRYTPION STEP variables:

sourcefile (populated with @User::filname)

outfile (when I normally decrypt a single file - this is a hard coded path    C:\outfile location\outflename.txt)

----------------------------

Issues are- each file needs to be decrpted with a new file name

filename_02012012.txt.pgp --> filename_02012012.txt --> filename.txt

filename1_02012012.txt.pgp --> filename_02012012.txt -->filenam.txt

 

 

 


Posted: 2/7/2012

Padawan 1437  points  Padawan
  • Joined on: 3/24/2010
  • Posts: 196

No apologies needed - MANY of us have been where you are.  I just wanted to get as much info as possible to try to help out.

Here's a blog I posted that helps with the step-by-step on copying / moving files.  What I put together is in a sequence container, but the same principles should apply within a loop container.  http://www.bidn.com/blogs/KeithHyer/bidn-blog/2465/copy-and-rename-a-file-in-ssis-using-the-file-system-task 

Take a look at that to see if it helps.  I'll see if I can put together a walk-through like that one this afternoon to help out.

Keith Hyer


Posted: 2/7/2012

Jedi Youngling 16  points  Jedi Youngling
  • Joined on: 6/25/2010
  • Posts: 8

Excellent Example.  I got it to work - maybe with some unecessary muscle - but still learning.

 

For the outfile (and this is where it is a little clugie) I appended the word "decrypted" to the filename 

I created a script task that has the ReadOnlyVariable set to the ForEachLoop variable filename.

 

Then I passed in the variable file name + decrypted and then used Rename - (using VB 2008).


Posted: 2/7/2012

Padawan 1437  points  Padawan
  • Joined on: 3/24/2010
  • Posts: 196
Answered  Answered

Glad you got it working!

I published a blog entry with what I came up with to handle this.  Take a look and let me know what you think if you have time.

http://www.bidn.com/blogs/KeithHyer/bidn-blog/2511/a-file-manipulation-step-by-step-geared-toward-pgp-decryption

Keith


Posted: 2/7/2012

Jedi Youngling 16  points  Jedi Youngling
  • Joined on: 6/25/2010
  • Posts: 8

Awesome - Thank you.  I will def try that way..it seems more flexible.  In my instance...I am certain(to a point) of the file names.  Your way is much more elegant.

 

Thanks for the help. V


Posted: 2/7/2012

Padawan 1437  points  Padawan
  • Joined on: 3/24/2010
  • Posts: 196

Glad you like it - if you run into anything - let me know, I'm happy to lend a hand ( as time allows ).

Keith


Posted: 3/14/2012

Padawan 120  points  Padawan
  • Joined on: 6/14/2010
  • Posts: 45

Hi Keith,

Its me again with a new issue, I'll need help in getting  10 .txtfiles from FTP to my local drive, the folder name is the date <03122012> this changes dynamically everyday, from your earlier post i was able to get the folder name figured out and the local drive and remote drive, but im not sure how do i get the <03122012> folder open and get all the txt files to my local machine. or if i can move the complete folder to my local shared drive that would be pretty awesome . Can you guide me thru with any screenshots please..

 

Thank you very much!!


Posted: 3/14/2012

Padawan 120  points  Padawan
  • Joined on: 6/14/2010
  • Posts: 45

Hi Keith,

Its me again with a new issue, I'll need help in getting  10 .txtfiles from FTP to my local drive, the folder name is the date <03122012> this changes dynamically everyday, from your earlier post i was able to get the folder name figured out and the local drive and remote drive, but im not sure how do i get the <03122012> folder open and get all the txt files to my local machine. or if i can move the complete folder to my local shared drive that would be pretty awesome . Can you guide me thru with any screenshots please..

 

Thank you very much!!


Page 1 of 1 (10 items)