question

Ankur_1982 avatar image
Ankur_1982 asked

Zip files using ssis

Hi Pavel I have a table in which I have different "buyer ID's" . they can be repetetive (1111122222333344444). 1 task: to extract each buyer in text file (Which is did with SSIS in for each loop. i had ) so i have those txt files in 1 folder ( 1.txt, 2.txt, 3.txt.4.txt) each txt file has all records of related buyer. 2 task : now i have to zip those files (using 7ZIp.).. i can zip them all together but i need to zip them indivisual.. for example; they should look like .(1.zip , 2.zip ,and so on) I hope this can help you to understand. Can you send me link or tell me here with proper arguments. Ankur
ssis
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
KenJ avatar image
KenJ answered
1. New Package 2. New string variable with package scope - `CurrentFile` 3. New Foreach Loop Container 4. Edit Foreach Loop container - Collection Tab -> Folder = `fullPathToFolderWithTextFiles` - Variable Mappings Tab -> `User::CurrentFile` maps to Index 0 5. New Execute Process Task inside the Foreach Loop container 6. Edit Execute Process Task - Process Tab -> Executable = `fullPathOf7z.exeFile` - Process Tab -> Working Directory = `fullPathToFolderWith7z.exe` - Expressions -> For Property "Arguments" set Expression = `"a " + @[User::CurrentFile] + ".zip " + @[User::CurrentFile]` 7. Save and Run Package If it's useful, the same answer to the same question is here: [ http://ask.sqlservercentral.com/questions/72600/compress-via-ssis-script-task/76166][1] [1]: http://ask.sqlservercentral.com/questions/72600/compress-via-ssis-script-task/76166
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.