Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there any linux command-line utility that can handle both Windows and Linux archive formats ?

I'm writing a script that needs to be able to extract info ( listing files/folders inside is crucial ) from most popular archive formats used on both OS'es.

Or maybe a script that provides an API, selecting the appropriate utility depending on filetype ?

share|improve this question

migrated from stackoverflow.com Sep 15 '10 at 2:20

This question came from our site for professional and enthusiast programmers.

    
What sort of archives are you thinking of? TAR vs ZIP? Or 'ar' vs the Windows librarian? Or something else? –  Jonathan Leffler Sep 14 '10 at 19:20
    
Funny - the close votes say "doesn't belong here", but one chooses SU and the other SF. –  Jonathan Leffler Sep 14 '10 at 19:20
    
Most common formats - such as TAR for Linux and RAR, ZIP, 7z for Windows - I have many archives on my NTFS partitions, most in RAR or ZIP format, plus some in 7z, but I'm on Linux most of the time so I'm looking for an app that can handle all of these formats. –  Mihai Rotaru Sep 14 '10 at 21:53
    
@Jonathan: Well, that is an issue of concern to both groups (general uses and administrators). I went with Super User. –  dmckee Sep 15 '10 at 1:31
add comment

2 Answers

up vote 2 down vote accepted

atool works great for just this sort of thing. The great part is that you don't have to juggle the various command-line switches for tar, zip, rar, etc in your brain, just aunpack <your-compressed-file> and voila! Another great feature: it makes sure your archive gets extracted into its own directory (great for when people distribute archives that aren't packed into a top-level directory!)

share|improve this answer
    
yep, that's exactly what I was looking for, thanx ! –  Mihai Rotaru Sep 15 '10 at 10:53
add comment

I think 7zip supports most formats. There's a command line utility called 7z.

share|improve this answer
    
it does, but it's man page mentions that it shouldn't be used for backup purposes on Linux –  Mihai Rotaru Sep 15 '10 at 10:54
    
Extracting the listing should be safe. If your restoring then perhaps not. I would expect restore of Windows archives on Linux to results in messed up permissions/ownership at the least. –  Chris Nava Sep 15 '10 at 14:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.