feat(bash): Add trash put command
This commit is contained in:
parent
556c9fb8d7
commit
badeeba6a9
3 changed files with 29 additions and 0 deletions
|
@ -26,3 +26,17 @@ if [ -f "$HOME/Documents/coding/dotfiles/shell/alias/alias" ]; then
|
|||
. $HOME/Documents/coding/dotfiles/shell/alias/alias
|
||||
fi
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
function tp {
|
||||
if [ -d $1 ]
|
||||
then
|
||||
if ! gum confirm "$(basename $1) is directory! Do you really want to delete it?"
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
mv $(realpath $1) $HOME/.local/share/Trash/files/
|
||||
echo -e "[Trash Info]\nPath=$(realpath $1)\nDeletionDate=$(date "+%Y-%m-%dT%H:%M:%S")" > $HOME/.local/share/Trash/info/$(basename $1).trashinfo
|
||||
gum style --bold --border rounded --border-foreground "#F5A9B8" --foreground "#5BCEFA" "$(basename $1) has been thrown in the bin"
|
||||
}
|
||||
|
|
3
shell/scripts/AutoDeleteDownloads.sh
Normal file
3
shell/scripts/AutoDeleteDownloads.sh
Normal file
|
@ -0,0 +1,3 @@
|
|||
#! /usr/bin/env sh
|
||||
|
||||
find $HOME/Downloads/ -type f -mtime +14 -print
|
12
shell/scripts/trash.sh
Executable file
12
shell/scripts/trash.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#! /usr/bin/env bash
|
||||
if [ -d $1 ]
|
||||
then
|
||||
if ! gum confirm "$(basename $1) is directory! Do you really want to delete it?"
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
mv $(realpath $1) $HOME/.local/share/Trash/files/
|
||||
echo -e "[Trash Info]\nPath=$(realpath $1)\nDeletionDate=$(date "+%Y-%m-%dT%H:%M:%S")" > $HOME/.local/share/Trash/info/$(basename $1).trashinfo
|
||||
gum style --bold --border rounded --border-foreground "#F5A9B8" --foreground "#5BCEFA" "$(basename $1) has been thrown in the bin"
|
Loading…
Reference in a new issue