Extract multiple tar.gz files

hey people
I.ve got a problem here. I.ve got a folder with about 100 .tar.gz files, and I want to extract them all with 1 command. How do I do this? "tar zxvf *.tar.gz" doesn.t work...
cheers

find . -name "*.tar.gz" -exec tar xvzf {} ;

Similar Messages

  • Extract A tar.gz file

    Ok guys,
    I have a program that extracts the contents of a tar.gz file. Right now it does extract one of the files and then throws an error:
    com.ice.tar.InvalidHeaderException: bad header in block 9 record 10, header magi
    c is not 'ustar' or unix-style zeros, it is '1141115144674854', or (dec) 114, 11
    1, 51, 44, 67, 48, 54
            at com.ice.tar.TarInputStream.getNextEntry(Unknown Source)
            at Extract_TAR_GZ_FILE.untar(Extract_TAR_GZ_FILE.java:37)
            at Extract_TAR_GZ_FILE.run(Extract_TAR_GZ_FILE.java:55)
            at Extract_TAR_GZ_FILE.main(Extract_TAR_GZ_FILE.java:67)
    bad header in block 9 record 10, header magic is not 'ustar' or unix-style zeros
    , it is '1141115144674854', or (dec) 114, 111, 51, 44, 67, 48, 54 The class that extracts the files:
    import java.io.*;
    import com.ice.tar.*;
    import javax.activation.*;
    import java.util.zip.GZIPInputStream;
    public class Extract_TAR_GZ_FILE {
         public static InputStream getInputStream(String tarFileName) throws Exception{
          if(tarFileName.substring(tarFileName.lastIndexOf(".") + 1, tarFileName.lastIndexOf(".") + 3).equalsIgnoreCase("gz")){
             System.out.println("Creating an GZIPInputStream for the file");
             return new GZIPInputStream(new FileInputStream(new File(tarFileName)));
          }else{
             System.out.println("Creating an InputStream for the file");
             return new FileInputStream(new File(tarFileName));
         private static void untar(InputStream in, String untarDir) throws IOException {
           System.out.println("Reading TarInputStream... (using classes from http://www.trustice.com/java/tar/)");
          TarInputStream tin = new TarInputStream(in);
          TarEntry tarEntry = tin.getNextEntry();
          if(new File(untarDir).exists()){
               while (tarEntry != null){
                  File destPath = new File(untarDir + File.separatorChar + tarEntry.getName());
                  System.out.println("Processing " + destPath.getAbsoluteFile());
                  if(!tarEntry.isDirectory()){
                     FileOutputStream fout = new FileOutputStream(destPath);
                     tin.copyEntryContents(fout);
                     fout.close();
                  }else{
                     destPath.mkdir();
                  tarEntry = tin.getNextEntry();
               tin.close();
          }else{
             System.out.println("That destination directory doesn't exist! " + untarDir);
         private void run(){
              try {               
                   String strSourceFile = "G:/source/BROKERH_20080303_A2008_S0039.TAR.GZ";
                   String strDest = "G:/source/Extracted Files";
                   InputStream in = getInputStream(strSourceFile);
                   untar(in, strDest);          
              }catch(Exception e) {
                   e.printStackTrace();          
                   System.out.println(e.getMessage());
         public static void main(String[] strArgs) throws IOException{
              new Extract_TAR_GZ_FILE().run();
    }The file I tested with can be found here:
    http://www.yourfilehost.com/media.php?cat=other&file=BROKERH_20080303_A2008_S0039.TAR.GZ
    Any help? Thanks a bunch.

    I fixed the problem. It was the ftp transfer of files program which wasn't set to BINARY mode. I edited that program and then rerun the above class and boom.. It worked.
    Thank you guys for responses.Great! Glad you got it working.
    ~

  • How to extract a .tar.gz file in IBM AIX 6.1

    we are in R12.1.3 on IBM AIX 6.1,we took the cold backup of prod Instance using the below command
    nohup tar cvf - /u01/oracle/prod/db | gzip > /u01/backup/backup_prod/prod_db.tar.gz &
    nohup tar cvf - /u01/oracle/prod/apps | gzip > /u01/backup/backup_prod_8035/prod_apps.tar.gz &
    we tried to extrac the above 2 .tar.gz files on the same server using below commands, they are extracting on source location i.e /u01/oracle/prod/db.so original files getting updated with old one
    cd /u01/backup/backup_prod_8035
    $gunzip < prod_apps.tar.gz | tar xvf -
    $gunzip < prod_db.tar.gz | tar xvf -
    Please let me know how to extract this files in the same folder with out affecting the original files
    Thanks in advance

    Helios,
    Thank you very much for your reply
    Is it possible to do both gzip and tar -xvf in single commnd because we don't have that much space on the server
    when we execute gzip -d /u01/backup/backup_prod/prod_db.tar.gz it will create file as prod_db.tar again we need to execute
    tar -xvf /u01/backup/backup_prod/prod_db.tar
    In the above command either we need to give . to untar the files in the same directory same like Linux.
    With out . in aix the untar files are over riding on source location i.e /u01/erp/prod
    Please advice

  • Extracting tar.bz2 files.

    How can i extract tar.bz2 files?. zip, jar, tar can be extracted within java. But how tar.bz2?.

    Some tars have built-in knowledge of the bz2 (bunzip) compression format.
    Tar ("tape archive") is to package several files in one archive or to extract them. The archive files can be called "*.tar".

  • Automator workflow to TAR multiple files in a single directory into multiple TAR archives, in succession?

    Good afternoon,
    I have set up an automator service that TAR's a folder into an archive for me and it works quite nicely. Idealy however, I would like to be able to highlight several folders, right click and have automator tar each folder into it's own TAR archive, but do it one by one.
    Example:
    FOLDER 01
    FOLDER 02
    FOLDER 03
    Highlight all - Right Click - "TAR Folder" - Automator takes over at this point and TARs each one into:
    FOLDER 01.tar (Once complete moves onto:)
    FOLDER 02.tar (Once complete moves onto:)
    FOLDER 03.tar (Finished)
    I'm not 100% sure so I guess it would be a good time to verify, is there a problem with having the system try to TAR multiple folders at one time? If it is not a problem then I guess this discussion itself is pointless and I can simple right click on each folder and select "TAR Folder" and just wait until they're all finished. I would think that it would be ideal for the system to do each one individually and not try to do them all at one time.
    Any help would be appreciated.
    Thank you!!

    I don't think I have the following totally fleshed out but you probably can extrapolate on it.   This is a service which you can right click a set of folders  and it will tar the files within those selected folders with then file names "name xxx.tar", where name is the tar'ed file/folder and xxx is a count within the folder.
    I think that is what you originally specified so I am a bit confused by your script with the bit about Archive.tar. 
    Anyway here the basic idea:
    I ran the script directly with a folder argument just to see it indeed tar's up all the stuff inside, one tar per item.

  • Zip and extract multiple files using java program

    how can i zip and extract multiple files using java program.

    Hi,
    Look into the java.util.zip and java.util.jar they expose methods to manipulate zip and jar files.

  • Jar File for uncompress *.tar.Z-File

    hello,
    i'm locking for a jar -file to uncompress *.tar.Z files but i cant't found souch a jar file.
    do you know where i can download a jar-file wich suppose to extract a *.Z-Archiv? You do you know how i can extract a *.tar.Z-Archiv?
    Torsten

    hello,
    i'm locking for a jar -file to uncompress *.tar.Z files but i cant't found souch a jar file.
    do you know where i can download a jar-file wich suppose to extract a *.Z-Archiv? You do you know how i can extract a *.tar.Z-Archiv?
    Torsten

  • Handling tar.gz files

    Hi all,
    I am looking to get PHP up and running on my Mac I found the PHP modules on http://www.entropy.ch/software/macosx/php/ which was linked directly from php.net.
    The tutorial for installation says NOT to use Stuffit but to use BOMArchiveHelper instead to unpack the installation files.
    I have clicked "get info" on my php-5.2.1.tar.gz file and chose BOMArchiveHelper to open the file.
    Problem is when I double click the file a second archive is created, it is compressing again instead of unpacking!
    Any help with this will be greatly appreciated. A second option could be if you can point out a tutorial for correctly handling any compressed file from the command line.
    Thanks in advance.
    Juan

    Juan:
    Try this. Create a new folder in your desktop (let's say you called it PHP) and put your archive in there. Then open the terminal (in Utilities) and change directories to the new folder:
    cd ~/Desktop/PHP
    Then, extract the archive with
    tar -xzvf php-5.2.1.tar.gz
    That should decompress and unarchive the contents of the "tarball" into the PHP directory. We created the PHP directory only to prevent a potential large number of files loose in your desktop.
    Good luck,
    Juan-Pablo

  • Creating Multiple XML target file

    HI Experts,
    I would require some guidance from you. I have a situation whereby, I have to create multiple XML target file based on records.
    The job in my hand is to extract the customer master from ECC and load it into XML files. But the catch is I need to create one XML file per customer. ie if my source has 500 customer then i have to create 500 XML and each XML file should contain all the information for that customer.
    Can anyone guide me how to split the target XML in a single job. i.e. One XML per record of source data.

    Hi Dirk,
    Please find the below screenshot of job
    workflow
    Initialization Script
    While LOOP
    Increment Script
    data flow
    Target XML
    Please help me with this.

  • Reading contents of tar.gz file programatically

    Hi,
    I have a file explorer type application, where I want the user to be able to double click on the tar.gz file and see the contents of the tar archive inside the .gz file.
    Of course, we dont want to have to extract the entire .gz file first. But it seems that the only way to read a .gz file is to use GZIPInputStream and if we through that, we will end up extracting the entire file.
    So can anyone tell me how to go about doing this?

    Hi,
    yes you're right. It's quite tricky sometimes to get what you need from a GZip file.
    What I found out today worked greatly.
    First of all, you need to get Apache Ant and inside the ant.jar file you'll locate the TAR package under tools (org.apache.tools.tar)
    So:
    1) Create a GZIPInputStream from the file (java.util.zip.GZIPInputStream)
    2) read the file entirely, coping it using a FileOutputStream
    3) In point 2, you created a tar file, you can read it with TarInputStream in org.apache.tools.tar TarInputStream.
    4) Get the entry you look for with TarEntry using
    - TarInputStream ts = new TarInputStream(file);
    - while (true){
    TarEntry t = ts.getNextEntry();
    if (tgetName().equals("myEntry")){
    //use ts to read this entry
    ts.read (buffer, 0, buffer.length)
    5) You have the unpacked Gzip entry where you want. Enjoy!
    ZazzaZ

  • I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.

    I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.

    I am not aware of a way except for photos that allows you to select multiple files in an email. I even checked settings in the Adobe Reader app, and it does not show that ability.

  • How to load multiple .wrl (VRML) files?

    Hi all,
    I need to load four components of a coffee table into the virtual universe, the four components are top, base, left leg and right leg. I use four parts not one whole single object because in this way when I change the size of this furniture, I can make the thickness of the edges fixed, which is a must. The four parts consist a table correctly in the design software TopSolid, but when I load the four .wrl ojbect files seperately in the application, they cannot compose a table correctly. I guess the reason is the four components have been resized and translated automatically in the VRML loader. I have reviewed the source code of the VRML loader and some related source code but not be able to find where the auto resize code is.
    I have used four Wavefront .obj files instead to do another technical demonstration, if I disable the ObjectFile.RESIZE flag, and just scale the four parts by myself using the same scale factor, I can get a perfect coffee table, with every part in correct location. But my supervisor insist on using VRML .wrl files in our project.
    I hope someone can give me some kind instructions or advises on how to do it in VRML97 loader (https://j3d-vrml97.dev.java.net/).
    Any help will be highly appreciated.

    Answered here : http://www.java.net/forum/topic/javadesktop/java-desktop-technologies/java-3d/trying-load-multiple-wrl-vrml-files-same

  • Why can't I open multiple sparse image files at the same time in FCPX?

    I work in a multiple editor enviroment, where we have hundreds of different projects.  They are all divided into sparse image files to keep them all separated.  I used to be able to mount multiple sparse image files and see them all in FCPx.  But recently, FCPx upon opening, will close out all but one sparse image.  The images are still mounted to the OSx but FCPx will not recognize them.  I can only open one sparse image at a time.  I am needing to export multiple projects at the end of the day, and can't batch export or send them all to compressor because I can open up multiple projects.

    I work in a multiple editor enviroment, where we have hundreds of different projects.  They are all divided into sparse image files to keep them all separated.  I used to be able to mount multiple sparse image files and see them all in FCPx.  But recently, FCPx upon opening, will close out all but one sparse image.  The images are still mounted to the OSx but FCPx will not recognize them.  I can only open one sparse image at a time.  I am needing to export multiple projects at the end of the day, and can't batch export or send them all to compressor because I can open up multiple projects.

  • How to combine multiple purchased aac files into one aac file

    I recently purchased in iTunes an album consisting of 16 m4a files.  I ended up creating a playlist in iTunes for the songs.  I would like to create one m4a file which combines all and then play it in iTunes.  Is the copy protection preventing me from doing so?
    I know how to convert m4a files that I have converted to mp3 and combine them using Terminal with a cat command.  Then I import that combined file into iTunes.  All is well in this case.  I tried this with the 16 m4a files and I could not import the resultant mp3 file into iTunes.
    Any way to combine multiple purchased aac files?

    A simple way to accomplish the job, though not recommended is to print the 2 page file to a new PDF with multi-up (assuming you select vertical rather than horizontal locations) and adjust the paper in the Adobe PDF printer to be 8.5X22. At least you might give it a shot. Some variation, along with rotation possibly, might work.

  • Issue in reading multiple time properties file

    Use Case:
    I have a page in which i have to show some Outage Messages on page. So I have configured outage message in properties files. This message should me rendered each time when it finds that properties file in class path or it finds the values w.r.t their keys.
    So what I decide that I shall write java method and call this method on Loading the page but here what happen is that whenever that page is load each time that reader file will call , that will create memory leak .
    So, anyone help me on this. What will be the best approach for that reading multiple times properties file?
    I will be grateful for any help you can provide
    Thanks

    Hi,
    have a bean at applicationScope, somewhat like this
    import java.util.HashMap;
    public class ApplnProperties {
        private HashMap _propMap;
        public HashMap getPropMap() {
            if(_propMap == null){
                //read the properties file and populate _propMap
            return _propMap;
    }here we put condition _propMap == null so it would be called only once during application lifecycle.
    and on page you can refer the prop map like following
    #{beanName.propMap['KEY1']}Regards,

Maybe you are looking for

  • Importing CD - No Disk Error Message When Ejecting CD

    Every since I upgraded my itunes to the latest version, I am getting an error message telling me there is no cd every time I eject my cd after importing. It gives me an option to retry, continue and cancel. No matter what I pick it does not recognize

  • Missing part of MP3 when in Clip Trimmer

    Hey guys, I just started using iMovie, was quite knowledgable with Adobe Premiere, but switched to a Mac. Working on a little side project with a band and I have my video clip alright, but when I come to add the 26min sound clip, in the clip trimmer,

  • Release date of iPhone 4S in UAE

    When is the iPhone 4S getting released in UAE?          

  • 10.4.7 update, is it worth it or are there issues for iMac Intel?

    I have 10.4.6 running seamlessly, is it worth updating or have there been problems? Thanks. iMac 2.0 GHz Intel Core Duo 20" 512MB (early 2006)   Mac OS X (10.4.6)   iBook G4 OS X 10.3.9

  • P6 R8.2 Integration API

    Hi, I'm trying to use integration API on P6 R8.2, I have installed P6 R8.2 with Oracle XE, when I'm trying to use integration API I just get "Unable to get database instances". Do I have to install weblogic? or Do I miss a configuration?