Date: Tue, 15 May 2001 14:01:16 -0600 From: Duke Normandin <01031149@3web.net> To: Ryan Thompson <ryan@sasknow.com> Cc: Freebsd Questions <freebsd-questions@freebsd.org> Subject: Re: Recycle bin for FreeBSD? :-) Message-ID: <20010515140115.A137489@mandy.rockingd.calgary.ab.ca> In-Reply-To: <Pine.BSF.4.21.0105150914010.42439-100000@ren.sasknow.com>; from "Ryan Thompson" on Tue, May 15, 2001 at 09:18:10AM References: <20010514085921.E16043@storm.ca> <Pine.BSF.4.21.0105150914010.42439-100000@ren.sasknow.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
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
[-- Attachment #2 --]
#!/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
[-- Attachment #3 --]
#!/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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010515140115.A137489>
