Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Using MvMac when possible to increase speed' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using MvMac when possible to increase speed
Authored by: jlllopis on Jun 05, '03 08:38:34AM
This script is really great except for one reason: it always uses CpMac even when what we want to remove is in the same volume in which ~/.Trash is. In that circunstance, MvMac will be much faster.

I propose an easy solution: just try MvMac and if it fails (because the volumes are different) try CpMac + rm.

You have to replace de "move_file()" function in the script with this code:

move_file ()
{
    if [ -n "$verbopt" ]; then
        echo "Moving $1 to trash."
        chflags -R nouchg "$1"
        /Developer/Tools/MvMac "$1" "$dest" || (/Developer/Tools/CpMac "$1" "$dest" && /bin/rm "$1")
    elif [ -n "$forceopt" ]; then
        chflags -R nouchg "$1" > /dev/null 2>&1
        /Developer/Tools/MvMac "$1" "$dest" > /dev/null 2>&1 || (/Developer/Tools/CpMac "$1" "$dest" > /dev/null 2>&1 &&  /bin/rm "$1" > /dev/null 2>&1)
    else
        chflags -R nouchg "$1"
        /Developer/Tools/MvMac "$1" "$dest" || (/Developer/Tools/CpMac "$1" "$dest" && /bin/rm "$1")
    fi
}
(The lines starting with /Developer... are quite long but must be written in one line) Luis

[ Reply to This | # ]