LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-19-2010, 11:05 PM   #1
rajinkajun
LQ Newbie
 
Registered: May 2006
Distribution: Ubuntu 10.04
Posts: 10

Rep: Reputation: 1
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.
 
Old 12-19-2010, 11:21 PM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
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?
 
Old 12-20-2010, 08:24 AM   #3
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
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.

Last edited by MTK358; 12-20-2010 at 08:26 AM.
 
Old 12-20-2010, 12:39 PM   #4
CodeFreaker
LQ Newbie
 
Registered: Feb 2010
Posts: 27

Rep: Reputation: 12
Smile

Don't you like to use sample shell script?.. try it i feel that is easy.
 
Old 12-20-2010, 04:56 PM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by rajinkajun View Post
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.

Last edited by i92guboj; 12-20-2010 at 04:57 PM.
 
1 members found this post helpful.
Old 12-20-2010, 11:12 PM   #6
CodeFreaker
LQ Newbie
 
Registered: Feb 2010
Posts: 27

Rep: Reputation: 12
Quote:
Originally Posted by i92guboj View Post
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
 
Old 12-21-2010, 05:21 AM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,007

Rep: Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192Reputation: 3192
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How do I change ca.archive.ubuntu.com to ca2.archive.ubuntu.com at the command line kennymw Linux - Newbie 3 09-01-2009 02:52 AM
Archive files ust Linux - Newbie 3 03-06-2009 05:13 AM
Where is the Old-LQ archive? kFblind LQ Suggestions & Feedback 5 02-03-2006 08:51 AM
this doesn't look like a tar archive .phister Slackware 5 02-01-2004 01:19 AM
importing an MS Outlook archive archive.pst alloydog Linux - Software 2 08-29-2003 03:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration