GithubHelp home page GithubHelp logo

2xz's Introduction

2xz

(Re)compresses everything to .xz or .tar.xz.

Why do that?

Because .xz compresses fairly better than .zip or .gz. I've seen a file.tar.gz shrink from 32Mb to 8Mb when converted to .tar.xz — and that seems to be especially because of the smart way xz handles compressing when many of the files to be compressed are similar in contents.

For more, check xz in Wikipedia, or the developer's page.

Below: supported extensions to convert. Other files will be xz'd. Dirs will be tar.xz'd.

.7z .ar .bz2 .cb7 .cbr .cbt .cbz .gz .jar .lz .lzma .lzo .rar .tar .tar.bz2 
.tar.7z .tar.gz .tar.lz .tar.lzma .tar.lzo .tbz .tbz2 .tgz .tlz .tzo .Z .zip 
.xz* .tar.xz* .txz*  (* yep, we recompress them, to ensure maximum compression)

Usage

2xz [-n] <files>

Examples

# Help menu
2xz

# Converts those three, and backs up originals at ./OldArchives
2xz f1.jar f2.zip f3.tgz  

# Converts all .tar.gz and deletes the originals.
2xz -n *.tar.gz

Dependencies

Must have installed unrar-free, lzip, lzop, p7zip-full, gzip, bzip2 if you want to extract, respectively: .rar, .lzip, .lzop, .lzma, .7z, .gz, .bz2. Try:

sudo apt-get install xz-utils unrar-free lzip lzop p7zip-full gzip bzip2

Limitations (not exhaustive)

  • Recognizes filetype by extension, not by /usr/share/file/magic.
  • Does not handle password protection.
  • Limit cases not thoroughly tested. (Filenames with crazy characters, nested archives etc.)
  • Conversion of filenames with spaces not thoroughly tested; be cautious. I recommend detoxing those files. (sudo apt-get install detox)

Final notes

  1. To extract a .xz, run: unxz MYFILE.xz. To extract a .tar.xz, run: tar xvJf MYFILE.tar.xz.
  2. Note that unrar-free fails often. If you have only a few .rar, I'd suggest extracting them by hand with something like Peazip, and then recompressing the files normally to .tar.xz.
  3. USE IT AT YOUR OWN RISK. I wrote this carefully — but I suggest you back up your input files before using 2xz, as I may have overlooked something critical. Don't blame me if you run 2xz and your archive gets warped or your cat microwaved. But tell me about it, or fix it, so we can avoid other people's cat from being microwaved.

Good compressing!

2xz's People

Contributors

unabashed avatar

Watchers

James Cloos avatar Alexander Martínez Méndez avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.