From owner-freebsd-ports@FreeBSD.ORG Sat Nov 4 18:41:04 2006 Return-Path: X-Original-To: freebsd-ports@freebsd.org Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D91C016A494 for ; Sat, 4 Nov 2006 18:41:04 +0000 (UTC) (envelope-from ralf@starshadow.com) Received: from fangorn.starshadow.com (fangorn.starshadow.com [70.85.98.154]) by mx1.FreeBSD.org (Postfix) with ESMTP id 36F5443D53 for ; Sat, 4 Nov 2006 18:41:00 +0000 (GMT) (envelope-from ralf@starshadow.com) Received: from fangorn.starshadow.com (ralf@localhost [127.0.0.1]) by fangorn.starshadow.com (8.13.7/8.12.11) with ESMTP id kA4IevFq002968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 4 Nov 2006 12:40:57 -0600 Received: from localhost (ralf@localhost) by fangorn.starshadow.com (8.13.7/8.12.11/Submit) with ESMTP id kA4IeuS7002965 for ; Sat, 4 Nov 2006 12:40:57 -0600 X-Authentication-Warning: fangorn.starshadow.com: ralf owned process doing -bs Date: Sat, 4 Nov 2006 12:40:56 -0600 (CST) From: "J. R. Lenz" To: freebsd-ports@freebsd.org Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: useful shell script X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Nov 2006 18:41:04 -0000 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 # 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 -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- J. Ralf Lenz ralf@starshadow.com "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-