Re: Undelete for UFS2?



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"



Relevant Pages

  • Re: FORTH levels
    ... cat, mkdir, rm, mv, echo they have. ... Albert van der Horst, UTRECHT,THE NETHERLANDS ...
    (comp.lang.forth)
  • Re: FORTH levels
    ... cat, mkdir, rm, mv, echo they have. ... swapoff swapon sync sysctl tail tar tee telnet telnetd test todos ...
    (comp.lang.forth)
  • initrd help -- umounts root after pivot_root
    ... mkdir initrd ... The documentation says that linuxrc should pivot_root to the real root in ... echo "Genoppix Initrd Loaded, ... mkdir root home mnt ...
    (Linux-Kernel)
  • Re: Integrating LaTeX tables into "Word" [solution]
    ... .4os mkdir sxw-%%0.dir\Pictures ... del sxw-test.\Pictures\*.* ... But if you are ready to take the risk of interfering with the user directories possibly named 'Pictures' and less possibly 'META-INF', you can do it as follows: ...
    (comp.text.tex)
  • How to Install Inline:CPP module
    ... I am trying to install Inline:CPP module. ... Microsoft Program Maintenance Utility Version 6.00.9782.0 ... Copyright Microsoft Corp 1988-1998. ... mkdir blib\lib ...
    (comp.lang.perl.modules)