From owner-freebsd-questions Tue May 15 13:13:12 2001 Delivered-To: freebsd-questions@freebsd.org Received: from smtp2.cybersurf.net (smtp2.cybersurf.net [209.197.145.112]) by hub.freebsd.org (Postfix) with ESMTP id 9E6D337B42C for ; Tue, 15 May 2001 13:13:06 -0700 (PDT) (envelope-from 01031149@3web.net) Received: from 3web.net ([209.115.233.149]) by smtp2.cybersurf.net (Netscape Messaging Server 4.15) with SMTP id GDE85R00.BRL for ; Tue, 15 May 2001 14:13:03 -0600 Received: by 3web.net (EzMTS MTSAgent 1.22b Service) ; Tue, 15 May 01 14:12:22 -0600 for Received: from 3web.net (10.0.0.2) by 3web.net (EzMTS MTSSmtp 1.50 Service) ; Tue, 15 May 01 14:01:43 -0600 for Received: by mandy.rockingd.calgary.ab.ca (sSMTP sendmail emulation); Tue, 15 May 2001 14:01:17 -0600 Date: Tue, 15 May 2001 14:01:16 -0600 From: Duke Normandin <01031149@3web.net> To: Ryan Thompson Cc: Freebsd Questions Subject: Re: Recycle bin for FreeBSD? :-) Message-ID: <20010515140115.A137489@mandy.rockingd.calgary.ab.ca> Mail-Followup-To: Ryan Thompson , Freebsd Questions References: <20010514085921.E16043@storm.ca> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="vjrRYLbUSPDtzxSK" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from "Ryan Thompson" on Tue, May 15, 2001 at 09:18:10AM X-Envelope-Receiver: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --vjrRYLbUSPDtzxSK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 15, 2001 at 09:18:10AM -0600, Ryan Thompson wrote: > Michael P. Soulier wrote to freebsd-questions@FreeBSD.ORG: > > > On Mon, May 14, 2001 at 02:16:24AM +0000, Ryan Thompson wrote: > > > > > > [ Don't throw things at me, OK? :-) ] > > > > Tempting... :) > > No. Don't. :-) > > > > Is anyone aware of any simple replacement for rm(1) that mimics the > > > "trash" or "recycle" features of other OSes (i.e., moves the files to a > > > safe area under the users control). > > > > 1. Don't delete things you want to keep. :) > > OK, YOU tell 'em. :-) > > > > 2. > > > > TRASH='/pub/trashfolder' > > function rm { > > mv $* $TRASH || echo "Failed to move to trash" > > } > > > > Or something along those lines. > > Yeah, already whipped up something like that. My question is whether to > finish it, or find an existing one that works just as well. Try the attached scripts. I hope that this is close to what you were looking for. Later.... -- -duke Calgary, Alberta, Canada --vjrRYLbUSPDtzxSK Content-Type: application/x-sh Content-Disposition: attachment; filename="safe_rm.sh" #!/bin/sh if (mv $* ~/tmp) then echo -e '\nfiles have been moved to your ~/tmp directory.' echo -e 'To remove them use the purge command\n' else echo 'An error occured -- files not moved!' fi --vjrRYLbUSPDtzxSK Content-Type: application/x-sh Content-Disposition: attachment; filename="purge.sh" #!/bin/sh # # A script to purge files that have been "mv"ed to the ~/tmp directory # as a result of the aliased "rm" command. Checks for files not changed # in the last 7 days and removes them. # cd ~/tmp if (/bin/find . -ctime +7 -ok rm {} \; ) then echo -e "\nfiles older than 7 days in ~/tmp have been removed." else echo "An error has occured -- files not removed!" fi --vjrRYLbUSPDtzxSK-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message