Add rudimentary trash function
This commit is contained in:
parent
cf14bde633
commit
7de5f862cb
1 changed files with 13 additions and 0 deletions
13
fun/trash.sh
Normal file
13
fun/trash.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
trash() {
|
||||
mkdir -p $HOME/.trash
|
||||
if [ -z "$@" ]; then
|
||||
find $HOME/.trash -type f -exec basename {} ';'
|
||||
else
|
||||
for file in "$@"; do
|
||||
mkdir -p $HOME/.trash/$(dirname $(realpath $file))
|
||||
mv "$file" $HOME/.trash/$(realpath $file)
|
||||
done
|
||||
fi
|
||||
}
|
Loading…
Reference in a new issue