From owner-freebsd-questions@FreeBSD.ORG Sun Aug 13 02:57:10 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 298F816A4DE for ; Sun, 13 Aug 2006 02:57:10 +0000 (UTC) (envelope-from dking@ketralnis.com) Received: from ketralnis.com (melchoir.ketralnis.com [68.183.67.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6823243D6B for ; Sun, 13 Aug 2006 02:57:01 +0000 (GMT) (envelope-from dking@ketralnis.com) Received: from [10.0.1.239] (ayla.wifi.int.ketralnis.com [10.0.1.239]) (authenticated bits=0) by ketralnis.com (8.13.6/8.13.6) with ESMTP id k7D2ufhN044203 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO); Sat, 12 Aug 2006 19:56:42 -0700 (PDT) (envelope-from dking@ketralnis.com) In-Reply-To: <531772590.20060812103027@rulez.sk> References: <44DD336C.1080403@comcast.net> <531772590.20060812103027@rulez.sk> Mime-Version: 1.0 (Apple Message framework v752.2) X-Priority: 3 (Normal) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <4CDA93C2-B453-4FF8-B4FF-53FA7FCC089C@ketralnis.com> Content-Transfer-Encoding: 7bit From: David King Date: Sat, 12 Aug 2006 19:20:50 -0700 To: Daniel Gerzo X-Mailer: Apple Mail (2.752.2) Cc: freebsd-questions@freebsd.org Subject: Re: Undelete for UFS2? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Aug 2006 02:57:10 -0000 >> Lastly surely someone has implemented a trash folder mechanism for >> freebsd... what is it called so I can look up how to install it? > > maybe something like: > mkdir ~/.trash > alias rm 'mv -iv \!* ~/.trash/' The problem with that solution is that when you move to a new system, you assume that your files will go to trash and then OH NO Better to do something like: alias del 'mv -iv \!* ~/.trash/' and get in the habit of using 'del' Or maybe a script called 'del' in your path that looks like (I use this one): #!/bin/sh DATESUFFIX=`date -u +%Y-%m-%d--%H.%M.%S` # All files deleted at the same time need the same serial LOCATION=${HOME}/.Trash if [ \! -d ${LOCATION} ]; then echo Creating $LOCATION...>&2 mkdir ${LOCATION} chmod 700 ${LOCATION} fi if [ \! -z $SUDO_USER ]; then THE_USER=$SUDO_USER else THE_USER=$USER fi for each in "$@"; do if [ -e "$each" ]; then NEWFILE=${LOCATION}/`echo "$each" | tr / _`.${DATESUFFIX} echo -n $each '->' ${NEWFILE} mv "$each" "${NEWFILE}" chown -R $THE_USER "${NEWFILE}" echo . else echo \"$each\" was not found >&2 fi done if [ \! -z "$PS1" ] || [ \! -z "$PROMPT" ]; then printf "Your trash can has %s and %s inodes\n" `du -hcd0 $LOCATION 2>/dev/null | tail -n 1 | awk '{print $1}'` `find $LOCATION| wc -l` fi