Re: Undelete for UFS2?
- From: David King <dking@xxxxxxxxxxxxx>
- Date: Sat, 12 Aug 2006 19:20:50 -0700
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
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"
- References:
- Undelete for UFS2?
- From: Chris
- Re: Undelete for UFS2?
- From: Daniel Gerzo
- Undelete for UFS2?
- Prev by Date: Re: BSDstats Project v2.0 ...
- Next by Date: acpi module build fails
- Previous by thread: Re: Undelete for UFS2?
- Next by thread: Slow Startup with nss_ldap
- Index(es):
Relevant Pages
|