All pastes #46734 Raw Edit

Unnamed

public shellscript v1 · immutable
#46734 ·published 2006-03-23 20:24 UTC
rendered paste body
#!/bin/bashdefTarget="/site/unrarred"[ -e "$defTarget" ] && {  [ ! -d "$defTarget" ] && {    echo "Error: TARGET $defTarget is invalid!"; exit 1;    }  }cds=`ls -1 $1|grep -iE "^cd[1-9]"`cds="$cds ."for cdDir in $cds; do  if [ -d "$1/$cdDir" ]; then    firstFile=`ls -1 $1/$cdDir|grep -iE "(part01|rar|001|part1)"|head -1`    if [ "$firstFile" != "" ]; then	mkdir -p $defTarget	echo "Started: `date`"	echo "Unpacking $1/$cdDir/$firstFile to $defTarget"	release=(`pwd | tr '/' ' '`)	echo `date +'%a %b %d %H:%M:%S %Y'` RARSTART: ${release[2]} >> /ftp-data/logs/glftpd.log	unRar=`unrar e -o+ -tsm- $1/$cdDir/$firstFile $defTarget`	echo `date +'%a %b %d %H:%M:%S %Y'` RARSTOP: ${release[2]} >> /ftp-data/logs/glftpd.log	echo "Stopped: `date`"    fi  fidoneexit 0