HOW TO READ A ZIP FILE WITH THE SAME NAME FROM MULTIPLE FOLDERS AND UNZIP THEM

  • Hi, Iam relatively new to bids.Following is the scenario where i need help.

    c:\archive has 3 sub folders

    c:\archive\1 c:\archive\2 c:\archive\3

    1 ,2, and 3(each of them)contains 11 files. which are 10 zipped rar files(once unzipped they are .txt files) and a date.txt file

    Lets say 10 rar files are like cust.rar,prod.rar,sales.rar...and so on. I only want to consider cust.rar

    Cust.rar contains the customer details and date contains the date for which the customer details and the remaining 9 zipped files correspond to;something like business date.

    I have to traverse through each folder and read only cust.rar and date.txt

    >then unzip cust.rar

    >populate customer table using the information in cust.txt(once its unzipped)

    Note: 1: The cust file name ie.cust.rar is same in each folder(1,2,3), same is with date.txt

    2: customer table contains a column called businessdate which should be taken from date.txt(date.txt corresponds to the business date for that particular cust record)

    customer table

    cust_id | cust_name | cust_address |...... |businessdate

    Please let me know whether i've missed to provide any information. Hoping to find some help asap:)

    Thanks...

  • Date.txt contains only one line ie.the businessdate for the rar files i've mentioned above.

    for example.folder 1> cust.rar,prod.rar....., date.txt; and date contains 2012-07-19

    folder 2> cust.rar,prod.rar....., date.txt; and date contains 2012-07-20

    folder 3> cust.rar,prod.rar....., date.txt; and date contains 2012-07-21

    .

    .

    and so on.

  • You have outlined your scenario, but have not asked any questions. What, specifically, are you having problems with?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • How do you execute the above scenario,thats the question.

    Thank you for having a look...

  • praveen901 (8/14/2012)


    How do you execute the above scenario,thats the question.

    Thank you for having a look...

    I'll be honest, I don't know how to execute a scenario.

    But if you're asking for a suggested outline of how you could achieve what you want in SSIS:

    1) Use a FOREACH loop to iterate and recurse round the files you are interested.

    a) Use an Execute Process task to perform the unzipping using command-line syntax.

    b) Use a dataflow to import the data you're interested in.

    I'm afraid that I do not understand your notes 1 and 2.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply