All pastes #728584 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-07 04:36 UTC
rendered paste body
#!/bin/bash

## Trash folder to use
## -------------------
# TRASH=.Trash-$USER
TRASH=.Trash


## Get the Current mount point
## -------------------
# Add more ", $##" to if you need support for more spaces
CWD=`pwd`
MNT=`df "$CWD" | grep % |awk '{ print $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20}'`

TRASH="$MNT"/"$TRASH"

## Test for the TRASH folder
if [ -d "$TRASH" ] ; then
        # The $TRASH exists
else
        mkdir "$TRASH"
        chmod 666 "$TRASH" # Make it r/w
fi

echo Moving Files to $TRASH

## Move each file to the trash
while [ ! -z "$1" ]; do
        mv "$1" "$TRASH/"
        shift
done