Script: xtract
Download Links: |
|
||||||
Description: | Decompresses and extracts archives | ||||||
Recommended For: | Linux | ||||||
Requires: | zenity (Recommended: gzip xz-utils unzip bzip2 p7zip unrar sudo gksu mountiso) | ||||||
License: | GNU GPL v3 * SEE DISCLAIMER * | ||||||
Related: | pcmanfm-mod mountiso | ||||||
News: | What’s New? | ||||||
Feedback: | comments – issues |
Overview
Designed for file manager integration, Xtract decompresses and extracts archives, and can also list archive contents. By default, an archive is extracted into a subfolder of the same name. Or, Xtract can prompt you for the destination or destination parent.
xtract --help Decompresses and extracts multiple archives. Designed for file manager integration. By default, archives are extracted into a subfolder of the same name, in each archive's parent folder. Requires: zenity (for gui functions) Recommended: gzip xz-utils unzip bzip2 p7zip unrar Recognized filetypes: .gz .bz2 .7z .xz .txz .tgz .zip .ZIP .rar .RAR .iso .ISO .tar .tar.gz .tar.xz .tar.bz2 .tar.7z Usage: xtract [OPTIONS] ARCHIVE ... OPTIONS: --ask show zenity gui prompt for destination parent and create auto-named subfolders (This is the default if the user has no write permission in archive parent folder) --combine use zenity gui prompt for destination folder and extract all archives to this one folder (overwrites existing files) --write | -w after extraction make ALL files in destination folder(s) user writable ( chmod -R u+rwX ) (ignored for user root) --list | -l instead of extracting, list archive contents --listfile | -f instead of extracting, list archive contents to a text file -a DIR extract to directory DIR using auto-named subfolders -c DIR | -C DIR extract all archives to combined directory DIR (overwrites existing files) -n no gui - do not use zenity for prompts, lists or errors NOTE: Pressing the Cancel button in the progress dialog does NOT cancel extraction. |
Xtract can be associated with the following filetypes in your file manager or MIME database:
[Desktop Entry] Name=Xtract Exec=xtract StartupNotify=false Terminal=false TerminalOptions= Type=Application NoDisplay=true MimeType=application/x-bzip;application/x-bzip-compressed-tar;application/x-gzip;application/zip;application/x-7z-compressed;application/x-bzip2;application/x-bzip2-compressed-tar;application/x-xz-compressed-tar;application/x-compressed-tar;application/x-rar;application/x-cd-image; |
Alternatively, set Xtract as a custom user command in PCManFM-Mod
Installation Instructions
Follow the standard Script Installation Instructions. Alternatively, for Debian and Ubuntu a deb package and a PPA repository are available. On Arch Linux, xtract can be installed automatically using the AUR.
Before running xtract, install required packages using your package manager. For example, on Debian/Ubuntu:
apt-get install zenity |
The following packages are also recommened with Xtract:
gzip xz-utils unzip bzip2 p7zip unrar sudo gksu |
For mounting ISO files, Xtract will use gksu to prompt for the root password, or for password-less ISO mounts, installing mountiso is recommended.
Having trouble with script Ignorant Guru. Trying to extract xz archive am getting:
I’m guessing this has to do with it being a tar.xz archive. I tried this with the –inter option just for kicks and its telling me that this does not appear to be a valid tar archive.
Comment by Todd Partridge (Gen2ly) | October 2, 2011 |
Hi Gen2ly – The ‘cannot access directory’ error indicates that xtract was either unable to create a folder named ‘firefox-7.0-1-i686.pkg’ for the extracted contents, OR that it was unable to cd into said directory (permissions?). As for the ––inter error, I can’t duplicate that even if I duplicate a permissions problem, but that error message is probably coming from tar, not directly from xtract. I would be interested to know how to duplicate that error, assuming it’s not a bad tar file, since xtract normally detects when it doesn’t have write permission in the current directory and will prompt for a destination. xtract shouldn’t have any problems with tar.xz – I use it all the time.
Comment by IgnorantGuru | October 3, 2011 |
Yeah. not sure what is going on. Tried regular extraction again today to see if I’m not going batty ;). Got it again:
http://ompldr.org/vYW9yeg
Permissions seem to be fine; I’m not sure what is going on.
Hmm, should add: I ran ‘lsl’ (an alias for ‘ls -la’) the second time after running the ‘xtract’ command.
Comment by Todd Partridge (Gen2ly) | October 6, 2011 |
Okay I think I see what it is – xtract wants the full path of the file. I never noticed this because I run it from within pcmanfm-mod, but it’s definitely a bug. I’ll correct that shortly – thanks. UPDATE: This has been corrected in 1.0.4.
Comment by IgnorantGuru | October 7, 2011 |
Just tested, works now. Appreciate the work; I’d been looking for a all-in-one command line decompresser so this is great.
Here’s a little feedback if you don’t mind. I’d like to know your reasoning of why you choose to create a command line extractor but use GUI tools in places. I’m not arguing the reason (I don’t know it :) ) it just intrigued me. The second thing that came to mind was: were you thinking of adding an option to choose an output target (similiar to -C with tar)?. This option is something that I know would be useful to me.
Comment by Todd Partridge (Gen2ly) | October 8, 2011 |
xtract was designed to work within a file manager – hence the GUI elements. I could easily add some command line options to make it GUIless- sounds like a good idea. I’m thinking options like this:
So -D and -C would be the command line versions of inter and inter-name. Or if inter or inter-name are used with –nogui, then it would prompt in the console instead of GUI. And a shell env var could be read for options so you don’t need to type -g. Or I may just let you do that with an alias. See what you think and when I get a chance I’ll add those.
Comment by IgnorantGuru | October 8, 2011 |
These options seem a bit too… hmmm, I’m not getting them right off. Perhaps I’m just not thinking them through. Yes?? Maybe I’m being a bit blunt here with these comments (perhaps I stayed up too late last night), if I am I apologize in advance. Here’s what I’m thinking, first thoughts:
For –inter|-i:
And for:
Not sure what this option means but I think it’s saying to choose this option if the user has no write permissions here. Perhaps???… O..O…O..k, got it. How about: –prompt-dir|-d and –prompt-par|-p??
Instead of –combine
Might like to use tar’s syntax above?
Not trying to make more work here, I hope.
I also am thinking that possibly command line versions of options are colliding with GUI ones???; would they be better off exclusively?
Comment by Todd Partridge (Gen2ly) | October 17, 2011 |
Non-gui mode has been added to xtract v1.1.0.
Comment by IgnorantGuru | November 18, 2011 |
Ah, very nice. Much better for me as it can take me awhile to understand things, these options help me out quite a bit. Yeah, I’ve seen your work with adding scripting support to PCmanFM. That’s right yes? Is this primarily designed with PCmanFM in mind?? If so I can see how this be a nice utility that way.
Not sure if it was intentional but xtract now lies outside known executable PATHs. It’s now resides like this: /usr/bin/xtract/xtract-1.1.0.sh. Probably not intentional?
Do appreciate the non-gui bit though as I think this will be a great all-around extractor.
Comment by Todd Partridge (Gen2ly) | November 20, 2011 |
> Not sure if it was intentional but xtract now lies outside known executable PATHs. It’s now resides like this: /usr/bin/xtract/xtract-1.1.0.sh. Probably not intentional?
No – I think maybe they discontinued used of ‘$startdir’ in pkg files for Arch. I have updated the PKGBUILD – hopefully that will correct that problem. I don’t have an Arch system handy at the moment to test it, so if anyone notices further problems please let me know.
Any file manager should be able to integrate with xtract, either via custom commands or by associating it with file types. The way I use it, I associate all archives with xtract, so in pcmanfm-mod I can just click on an archive to immediately extract it to its own subfolder, which I find the most handy behavior. I can also list the files inside (xtract ––list assigned to a custom command), or open it with an archive manager (file roller, etc).
Comment by IgnorantGuru | November 20, 2011 |
Actually using Ubuntu at the moment. Before ‘xtract’ stood as a common executable (/usr/bin/xtract I believe), now it’s a script outside the path (using your PPA I downloaded it). Here’s the package file list:
Comment by Todd Partridge (Gen2ly) | November 25, 2011 |
This problem, which also affected the recent update to mountiso, should be corrected in these updated packages:
mountiso_1.0.1-2_all.deb
xtract_1.1.0-2_all.deb
One of the tools I use to build the packages changed its behavior, hence the problem. Thanks for letting me know.
Comment by IgnorantGuru | November 25, 2011 |
Tried new version and ‘xtract’ is in the correct path. Works great, thank you. (tested with -n -l and -C options and did as I hoped for). :)
Comment by Todd Partridge (Gen2ly) | November 26, 2011 |