theniteowl
Programmer
Hi Everyone!
I have hundreds of xxx.tar.gz files that I need to extract two files each from and write those files to a folder of the same name as the original tar file or zip them into a zip file of the same name.
Each file has a file named subcntlfile in the root and a file called report0000.data under /data.
I can use these commands to extract the files
tar xvzf /mypath/999.tar.gz ./999/data/report0000.data --strip-components 3
tar xvzf /mypath/999.tar.gz ./999/subcntlfile --strip-components 2
This will extract the two files I need without creating the sub-folder from within the tar file.
I need to automate storing these two files into either a zip file or a folder of the same name as the beginning of the name of the tar file. In this case the name would be 999.
I would also like to use a shell script to read the names of the tar files one at a time to apply the above commands and any later processing to.
I can then FTP the zip files or folders to another server where I have to work with them.
If there is an easy method to convert .tar.gz to zip and lose the internal path names I could do that as well as I can handle reading the zip file to get the files on the other server but I cannot read tar.gz files on there.
I cannot install any applications to support this and have to work with what I have or what I can write.
Any help would be appreciated. Manually extracting these files would take many hours of tedious and error prone work. If I could only get an application that worked directly with tar files and would operate command line life would be wonderful but getting approval for new software is a long and arduous process.
Thanks.
Trent
At my age I still learn something new every day, but I forget two others.
I have hundreds of xxx.tar.gz files that I need to extract two files each from and write those files to a folder of the same name as the original tar file or zip them into a zip file of the same name.
Each file has a file named subcntlfile in the root and a file called report0000.data under /data.
I can use these commands to extract the files
tar xvzf /mypath/999.tar.gz ./999/data/report0000.data --strip-components 3
tar xvzf /mypath/999.tar.gz ./999/subcntlfile --strip-components 2
This will extract the two files I need without creating the sub-folder from within the tar file.
I need to automate storing these two files into either a zip file or a folder of the same name as the beginning of the name of the tar file. In this case the name would be 999.
I would also like to use a shell script to read the names of the tar files one at a time to apply the above commands and any later processing to.
I can then FTP the zip files or folders to another server where I have to work with them.
If there is an easy method to convert .tar.gz to zip and lose the internal path names I could do that as well as I can handle reading the zip file to get the files on the other server but I cannot read tar.gz files on there.
I cannot install any applications to support this and have to work with what I have or what I can write.
Any help would be appreciated. Manually extracting these files would take many hours of tedious and error prone work. If I could only get an application that worked directly with tar files and would operate command line life would be wonderful but getting approval for new software is a long and arduous process.
Thanks.
Trent
At my age I still learn something new every day, but I forget two others.