Mailinglist Archive: opensuse (1599 mails)

< Previous Next >
Re: [opensuse] Bash Guru help needed, recursively extract rarred files
  • From: Anders Johansson <ajohansson@xxxxxxx>
  • Date: Mon, 12 Oct 2009 23:07:00 +0200
  • Message-id: <200910122307.00437.ajohansson@xxxxxxx>
On Monday 12 October 2009 22:00:51 Dean Hilkewich wrote:
Ya something like that. Anyway of making check to see if the unrar was
found and successfully extracted before deleting the daydirs? Also I
notice that some of the older clients that are using the DOS based
version have their rar's first file as .r01 instead of .rar (older rar
version would be the reason for the extension difference I would
guess). Thanks for the help btw.

Hm, ok, something like this then

for clientdir in /backup/*; do
cd $clientdir
for daydir in $clientdir/*; do
rarfile=$daydir/*.rar
if [ ! -e $rarfile ]; then
rarfile=$daydir/*.r01
fi
unrar x $rarfile
[ $? -eq 0 ] && rm -rf $daydir
done
done

Anders
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >