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.

Do anyone know if there's some decent software which auto extracts anything which gets downloaded (to f.e. ~/Downloads)? If, let's say, I download x.tar, it would automatically extract it to x (folder).

share|improve this question

closed as off-topic by Tog, Kevin Panko, random May 15 at 14:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – Tog, Kevin Panko, random
If this question can be reworded to fit the rules in the help center, please edit the question.

    
I'd imagine some combination of cron and batch scripts would do it, but I don't know much about cron. –  Macha Dec 5 '09 at 16:26
    
You could make an applciation to do some polling to check for new tarballs. This is interesting... –  Linus Dec 5 '09 at 17:37
    
The question is unclear, let me rephrase it and see if that's what you want: whenever something new appears in the directory ~/Downloads, this stuff should look at it, identify if it's a tarball or other archive format, and if so extract it to another folder?? –  Davide Dec 5 '09 at 18:35

3 Answers 3

up vote 2 down vote accepted

You could maybe try a little mini-daemon along the lines of:

#!/bin/bash

DOWNLOAD_DIR=~/Downloads

while true;
do
    for file in $DOWNLOAD_DIR/*.tar*;
    do
        if [ -f $file ]
        then
            tar xf $file
            if [ $? -eq 0 ] # remove if successfully extracted
            then rm $file
            fi
        fi
    done
    sleep 5
done

Just start that running and away you go. I'm not sure what the performance implications of a bash forever loop would be, but just looking at it in top it doesn't seem to be too bad (i.e. it isn't in there.) You could boost the sleep time if necessary.

share|improve this answer
4  
+1 Better way would be to use the inotify command line interfaces inotify-tools.sourceforge.net/#info You could change the script to just run when the folder contents is modified. I think this would be the best way to go about this problem –  prestomation Dec 5 '09 at 18:20
    
Cool, I didn't know about inotify-tools. You're right, that would be much better than constantly polling in the script. –  ngm Dec 5 '09 at 18:25

You could use fsniper, which makes use of inotify.

From the fsniper homepage:

Common uses include making a single drop directory for all things from a webbrowser etc, and having semi-intelligent scripts figure out what to do with those files. You write the scripts yourself.

share|improve this answer

It's not automatic, but "right click > extract here" for gnome extracts it into a folder of the same name.

share|improve this answer
    
I know that, but I would love this procedure automated. –  Sirupsen Dec 5 '09 at 16:30
    
And that's what hackers are about. Probably superusers too... –  Nathaniel Dec 5 '09 at 21:40

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