LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Archive Conversion (https://www.linuxquestions.org/questions/linux-newbie-8/archive-conversion-851292/)

rajinkajun 12-19-2010 11:05 PM

Archive Conversion
 
Does anyone know if there's any way to convert an archive [ex: .tar.gz] to another archive format [ex. 7z]? I've been googling and searching for the better part of a week and I haven't come across any program that can do it on the linux platform. I don't want to have to extract the files and then place them in another archive format. Just seems like a waste of time, considering the versatility of the OS.

grail 12-19-2010 11:21 PM

Quote:

I've been googling and searching for the better part of a week and I haven't come across any program that can do it on the linux platform
Is this meant to imply it can be done under an alternate OS with a particular application?

MTK358 12-20-2010 08:24 AM

And this has nothing to do with Linux being a versatile OS. It has all to do about whether someone wrote a program like that for Linux.

EDIT: I have an idea, but it requires the use of a GUI archive manager.

Just open the archive with a GUI archive manager (such as Ark), go to File->Save As, and save it under a different format.

CodeFreaker 12-20-2010 12:39 PM

Don't you like to use sample shell script?..:) try it i feel that is easy.

i92guboj 12-20-2010 04:56 PM

Quote:

Originally Posted by rajinkajun (Post 4197325)
Does anyone know if there's any way to convert an archive [ex: .tar.gz] to another archive format [ex. 7z]? I've been googling and searching for the better part of a week and I haven't come across any program that can do it on the linux platform.

I'd like to see a program that can do exactly that on any other platform. I bet it doesn't exist, for most archive formats at least.

The fact that you don't see how the files are extracted and piped into a new file means nothing.

While theoretically possible it just doesn't pay off to convert one thing into another. It's (computationally speaking) a waste of time.

The same happens with images, usually. To convert a jpeg into a png you usually load the image using the correct decoder, then once the image is in a raw bitmap format in memory you save it again using whatever encoder you prefer. You don't convert jpeg to png: you decode jpeg, then encode png. For archives it's quite the same.

That is almost always true, unless two archive formats use the same algorithm, differing only in minor details in the file format that can be parsed easily.

Quote:

I don't want to have to extract the files and then place them in another archive format. Just seems like a waste of time, considering the versatility of the OS.
If all you want is not to see the ugly engines just use any GUI you like. If you don't mind using the shell you will find how easily that can be done with minimal pain.

As simple as.

Code:

for file in *.tar.bz2; do tar xf "$file" - | 7z a "${file%.tar.bz2}.7z"; done
Untested.

CodeFreaker 12-20-2010 11:12 PM

Quote:

Originally Posted by i92guboj (Post 4198204)
I'd like to see a program that can do exactly that on any other platform. I bet it doesn't exist, for most archive formats at least.

The fact that you don't see how the files are extracted and piped into a new file means nothing.

While theoretically possible it just doesn't pay off to convert one thing into another. It's (computationally speaking) a waste of time.

The same happens with images, usually. To convert a jpeg into a png you usually load the image using the correct decoder, then once the image is in a raw bitmap format in memory you save it again using whatever encoder you prefer. You don't convert jpeg to png: you decode jpeg, then encode png. For archives it's quite the same.

That is almost always true, unless two archive formats use the same algorithm, differing only in minor details in the file format that can be parsed easily.



If all you want is not to see the ugly engines just use any GUI you like. If you don't mind using the shell you will find how easily that can be done with minimal pain.

As simple as.

Code:

for file in *.tar.bz2; do tar xf "$file" - | 7z a "${file%.tar.bz2}.7z"; done
Untested.

Yes indeed..thanks mate..shell script is gud:)

grail 12-21-2010 05:21 AM

And if you don't like all the messy output you can simply throw some redirects to /dev/null and you won't get anything until your prompt comes back ;)


All times are GMT -5. The time now is 07:35 AM.