visual studio 2008 - SSIS How To Extract Multiple .ZIP Files To Multiple Folders -
problem/scenario:
inside of directory have multiple .zip archives. each of these contain mulitple .csv files. need extract contents of each .zip archive directory of same name source .zip archive:
c:\mydirectory\data1.zip extract files c:\mydirectory\data1 c:\mydirectory\data2.zip extract files c:\mydirectory\data2
i have foreach loop contains execute process task. task uses 7zip extract contents of each directory. task has following variables set:
varzipsourcefolder = \\<server>\c$\mydirectory varzipdestination = \\<server>\c$\mydirectory\ varzipfilename varexepath = c:\program files\7-zip\7z.exe
the problem of now, task runs , extracts files first archive successfully. however, when moving extract next .zip archive trying extract first directory created:
c:\mydirectory\data1.zip extracting c:\mydirectory\data1 c:\mydirectory\data2.zip extracting c:\mydirectory\data1
below screen grabs ssis project in vs2008:
foreach loop:
execute process task:
any appreciated! also, please let me know if need edit question in way communicate problem better.
so after ton of time , profanity i've got it.
i ended using @joost's custom unzip task handle unzipping getting , foreach loop configured work specific problem difficult task in own right.
i went ahead , recreated variables using comments @joost , @billinkc. took me second able wrap head around referring "slice , dice" of variable.
i'll best convey done in case else comes across in research.
answer/solution:
first, recreated variables scratch. made sure include 1 used joost's unzip task destination variable, , 1 source variable. these variables evaluated expressions below along other variable definitions:
varunziptasksource = @[user::varserver] + "\\" + @[user::varzipsource] + "\\" + @[user::varzipfile] + ".zip" varunziptaskdestination = @[user::varserver] + "\\" + @[user::varzipsource] + "\\" + @[user::varzipfile] + "\\" varserver = \\myserver\c$ varzipsource = \myfolder varzipfile = myfilename (no extension in filename)
next, set foreach loop container follows:
note: use unc path , select name only
note: name selection used create destination directories.
and unzip task configuration:
in summary, breaking apart path source , destination key. foreach loop grabs name of each .zip archive, creates directory based off of value, extracts data it.
i trying work without using joost's custom task. update answer (if possible) info.
thanks again @joost , @billinkc getting me moving in right direction.
Comments
Post a Comment