View Full Version : [all variants] Automaticly unpack compressed files?

June 21st, 2008, 09:29 AM
Not sure where to post this question, guess you can never go wrong in this forum.

I'm wondering if there is anyway to watch certain directory's for completed compressed files to have them automaticly unpacked .....

June 21st, 2008, 09:39 AM
You could of course write yourself a script to do it but I think you are better off just unpacking it manually by Right Clicking -> Extract here

June 21st, 2008, 09:57 AM
Why automatic?

June 21st, 2008, 10:19 AM
It's torrent related. Want to unpack and update my media server automaticly.

June 21st, 2008, 10:49 AM
Two dirs:


if *.zip present in ~/shared then:
[figure out zip name] (happy.zip)
mkdir ~/media/happy
unzip happy.zip to ~/media/happy
rm ~/shared/happy.zip [when completed, delete zip]
else blah blah
end if

(above pseudo doesn't handle the checking if complete)

Automation not always the best tool...

June 21st, 2008, 11:07 AM
If you can get md5 checksums with the torrent *.zip then you can probably check for completeness with that.

June 21st, 2008, 02:30 PM
check this out:


# Written by Nick Boldt, codeslave@ca.ibm.com
# $Id: unpack.sh.txt,v 1.1 2007-10-14 05:28:36 nickb Exp $

# settings:
# default folder in which to unpack video;
# default folder to move source folder when done unpacking

function usage ()
echo "";
echo "Usage: $0 <sourceDir> \\";
echo " [targetDir ($targDir)] \\";
echo " [deleteDir ($delDir)]";
echo "";

if [[ $# -lt 1 ]]; then usage; fi

pushd $1; sourceDir=`pwd`;
if [[ $2 ]] && [[ -d $2 ]]; then targDir=$2; fi
if [[ $3 ]] && [[ -d $3 ]]; then delDir=$3; fi

rarFile=$(find $sourceDir -name "*part*1*rar");
if [[ ! $rarFile ]]; then rarFile=$(find $sourceDir -name "*.rar"); fi
if [[ ! $rarFile ]]; then echo "ERROR: Could not find *.rar in $sourceDir!"; popd; exit; fi

pushd $targDir;
echo "";
echo -n "Unrar $rarFile ...";
unrar e -inul $rarFile;
echo " done.";
echo "";
popd; popd;
echo "";
echo -n "Moving $sourceDir into $delDir ...";
mv $sourceDir $delDir;
echo " done.";
echo "";