Description: Unball: Between new kernels, patches, and source, I found myself doing: tar jvxf filename.tar.bz2 tar xvzf filename.tar.gz unzip crappyformat.zip all the time. So I wrote a script called unball to perform the same operations I was doing over and over... it recognizes bz2s, zips, gzs, tgz, rars, jars, and tars. Put the "unball" script in your path and the kdeunball.desktop script in your servicemenus directory. Its quite handy to type unball from the console instead of nineteen different options... -maitre
I got tired of unball's inability to deal with filenames containing spaces, that annoying but harmless error it displays, and the limited number of formats it recognized so I decided to improve it.
Long story short, I ended up rewriting it from scratch. My version should be drop-in compatible with the KDE menu entry but, since I switched from KDE to Xfce+Konqueror a while ago, I can't test it.
Anyway, it's at http://www.ssokolow.com/MyPrograms/Gentoo
Actually, I'm working on my own service menu to be distributed along with the Nautilus (GNOME) equivalent to service menus, and the script itself.
I'd have it up already, but it's taking longer than expected to solve an "unace freezes up when called from Konqueror" bug.
By the way, sorry for the delayed reply.
Oh, and I also added support for properly handling tar files compressed with formats other than gzip and bzip2 as well as replacing the directory creation for zip files with something that only does it as needed and works for any archive format.
Just expect a shock if you look at the code. My coding style has been called everything from esoteric to awful. (I have a habit of using boolean operators instead of if/else blocks and cooking up shell equivalents for constructs from Python's standard library.)
First I want to thank you for this very nice script.
Found one error though;
peppe@hoth ~/inetpub/test: unball ExoPHPDesk_v1.2.rar
/home/peppe/bin/unball: line 10: [: =: unary operator expected
Found RAR, unballing ExoPHPDesk_v1.2.rar...
unrar: invalid option -- i
Try `unrar --help' or `unrar --usage' for more information.
Is it me of the script?
I like the unball script, it makes managing archives easier than it was on Windows. But there is one thing that's bothering me: zip files get unzipped into folders with names like zip-filename.zip, which is quite unergonomic when you're doing everything in the Konsole.
I suggest the following change to the script, which makes it handle zip archives without the need for ugly folders:
Didn't see your post til now - oops. :) There's a .desktop file in there, and there's an unball script. Move the .desktop file into your servicemenus directory and the unball script anywhere in your path, I suggest /usr/bin.
More detailed explanation:
Open up a console, say xterm.
1. su {enter}
2. enter root password {enter}
3. cp unball /usr/bin
4. locate servicemenus
This will hopefully find your
servicemenus directory for you.
It should be under a apps/konqueror
parent directory. If you do not
have locate. You can cd to /
"cd /" and do:
find | grep servicemenus to do the
same thing (just slower).
5. cp unball.desktop /path/servicemenus
6. Logout and backin.
Has anyone else noticed that if you open an archive, and then copy the contents, click up and paste, you get an error about not being able to write to (insert format here)? Is that a know bug?
I get exactly the same error all the time. When I drop to the command line and do it manually, everything works great. It seems to be a problem with Ark, though I'm not sure what.
for one its quicker, rather than ark loading my script just calls the cli utilities - another big one for me is I don't have a bunch of files littered everywhere b/c someone didn't know how to put paths in their archive. i find it really useful in consoles mostly, the six or seven line servicemenu was just easy to make...
-maitre
Ratings & Comments
23 Comments
I got tired of unball's inability to deal with filenames containing spaces, that annoying but harmless error it displays, and the limited number of formats it recognized so I decided to improve it. Long story short, I ended up rewriting it from scratch. My version should be drop-in compatible with the KDE menu entry but, since I switched from KDE to Xfce+Konqueror a while ago, I can't test it. Anyway, it's at http://www.ssokolow.com/MyPrograms/Gentoo
Update: In order to get nice integration with my Bazaar revision control, I moved it to https://launchpad.net/unball/
solid work, mind if I step on your toes and clean it up a bit? interested in merging it back into the service menu...
Actually, I'm working on my own service menu to be distributed along with the Nautilus (GNOME) equivalent to service menus, and the script itself. I'd have it up already, but it's taking longer than expected to solve an "unace freezes up when called from Konqueror" bug. By the way, sorry for the delayed reply.
Oh, and I also added support for properly handling tar files compressed with formats other than gzip and bzip2 as well as replacing the directory creation for zip files with something that only does it as needed and works for any archive format. Just expect a shock if you look at the code. My coding style has been called everything from esoteric to awful. (I have a habit of using boolean operators instead of if/else blocks and cooking up shell equivalents for constructs from Python's standard library.)
First I want to thank you for this very nice script. Found one error though; peppe@hoth ~/inetpub/test: unball ExoPHPDesk_v1.2.rar /home/peppe/bin/unball: line 10: [: =: unary operator expected Found RAR, unballing ExoPHPDesk_v1.2.rar... unrar: invalid option -- i Try `unrar --help' or `unrar --usage' for more information. Is it me of the script?
Bah - thats probably me - I'll check it and reup a better version.
I like the unball script, it makes managing archives easier than it was on Windows. But there is one thing that's bothering me: zip files get unzipped into folders with names like zip-filename.zip, which is quite unergonomic when you're doing everything in the Konsole.
I suggest the following change to the script, which makes it handle zip archives without the need for ugly folders:
Replace this *.zip)
echo -ne "Found zip, unballing $FILE...\n"
unzip -qq -d zip-$FILE $FILE
;;
*.ZIP)
echo -ne "Found ZIP, unballing $FILE...\n"
unzip -qq -d zip-$FILE $FILE
;;
with this
*.zip)
echo -ne "Found zip, unballing $FILE...\n"
unzip -qq -d `echo "$FILE" |sed "s/\.zip$//"` $FILE
;;
*.ZIP)
echo -ne "Found ZIP, unballing $FILE...\n"
unzip -qq -d `echo "$FILE" |sed "s/\.ZIP$//"` $FILE
;;
This makes unball turn filename.zip into filename/ instead of zip-filename.zip/.
Sweetness - you sed freak. I'll merge your changes. :)
Im very much new to this and when i dl the thing and unzip it, it doesnt have a program to open up with. So what do i do ?
Didn't see your post til now - oops. :) There's a .desktop file in there, and there's an unball script. Move the .desktop file into your servicemenus directory and the unball script anywhere in your path, I suggest /usr/bin. More detailed explanation: Open up a console, say xterm. 1. su {enter} 2. enter root password {enter} 3. cp unball /usr/bin 4. locate servicemenus This will hopefully find your servicemenus directory for you. It should be under a apps/konqueror parent directory. If you do not have locate. You can cd to / "cd /" and do: find | grep servicemenus to do the same thing (just slower). 5. cp unball.desktop /path/servicemenus 6. Logout and backin.
which theme do you have on kde3.2? i'm sorry for OT
thinkeramik - my menus are in XRender mode...
ehhmmm but the window decorations?????
nvidia...
thank you!
Has anyone else noticed that if you open an archive, and then copy the contents, click up and paste, you get an error about not being able to write to (insert format here)? Is that a know bug?
I get exactly the same error all the time. When I drop to the command line and do it manually, everything works great. It seems to be a problem with Ark, though I'm not sure what.
could be a known bug - I used konstruct to build KDE for me and I belive it patches the source for me. -maitre
that works fine for me.
Is this a known bug?^^^
I probably just don't get it, but how is this different then the service menus provided by ark? I.E. Extract to, Extract Here, et all?
for one its quicker, rather than ark loading my script just calls the cli utilities - another big one for me is I don't have a bunch of files littered everywhere b/c someone didn't know how to put paths in their archive. i find it really useful in consoles mostly, the six or seven line servicemenu was just easy to make... -maitre