Forum Discussion

gayathri12aug's avatar
gayathri12aug
New Member
7 years ago

How to extract / read the contents of tar file in groovy

Hi All,

The scenario I want to automate using groovy is as follows:

The response of a service give a zip/tar file. I am saving the 

output file in a path that I mention in "Dump File" Project Property of a particular service's request.

The archive file zip/tar is stored in the location specified in "Dump File" . Say the main archive file contains  folder1(with 5 im)age files, folder2,(with 5 image files inside it) ....  

I need to find out how many child folders are there in the main archive folder,and how many images are in each of the child folders;  get the name and size of the folders and the individual elements, using groovy.

I should be able to do the above process for both types zip & tar

 

-  I found out a solution for unzipping an archive folder and reading its contents by size and filename.

But I couldnt figure out how to untar the archive folder / to read the data by name & size.

 

Could some one help me with this please?