useful shell script

Beech Rintoul beech at alaskaparadise.com
Sat Nov 4 10:54:40 PST 2006


On Saturday 04 November 2006 09:40, J. R. Lenz wrote:
> Reclaiming disk space was a high priority on my laptop, which has a 4gb
> FreeBSD partition.  So, I wrote a useful shell script for removing all the
> "work" directories in the ports tree (I'm sure someone has already done
> this, but it saves a little bit of time for those people who are not
> fluent in shell scripting).  You'd be surprised how much disk space can be
> freed up by removing unused source code and compiled objects.
>
> Peace,
> - Ralf
>
> #!/bin/sh
> #
> # remove_work.sh
> # removes nasty, disk-hogging source code
> #   and compiled objects from ports tree
> #
> # J. Ralf Lenz <ralf at starshadow.com>
> #
>
> for i in `ls -Ad *`
> do
>    if [ -d /usr/ports/$i ]; then
>      cd $i
>      DIR=`pwd`
>      DESIRED_PATH=/usr/ports/$i
>      if [ "${DIR}" = "${DESIRED_PATH}" ]; then
>        for j in `ls -Ad *`
>        do
>          if [ -d /usr/ports/$i/$j ]; then
>            cd /usr/ports/$i/$j
>            if [ -d /usr/ports/$i/$j/work ]; then
>              CUR_DIR=`pwd`
>              echo "Removing ${CUR_DIR}/work..."
>              rm -rf work
>            fi
>            cd /usr/ports/$i
>          fi
>        done
>        cd /usr/ports
>      fi
>    fi
> done
>

portsclean -CDLP

cheers,

Beech

-- 
---------------------------------------------------------------------------------------
Beech Rintoul - Sys. Administrator - beech at alaskaparadise.com
/"\   ASCII Ribbon Campaign  | Alaska Paradise Travel
\ / - NO HTML/RTF in e-mail  | 201 East 9Th Avenue Ste.310
 X  - NO Word docs in e-mail | Anchorage, AK 99501
/ \  - Please visit Alaska Paradise - http://www.alaskaparadise.com
---------------------------------------------------------------------------------------











-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20061104/e8ab080a/attachment.pgp


More information about the freebsd-ports mailing list