You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
oh-my-fish/plugins/osx/trash.fish

20 lines
534 B
Fish

# Move a specified file to the Trash
function trash -d "Move a specified file to the Trash"
if [ (count $argv) -gt 0 ]
set -l trash_dir "$HOME/.Trash"
for item in $argv
if test -e $item
set -l item_name (basename $item)
if test -e "$trash_dir/$item_name"
set -l current_time (date "+%H.%M.%S")
mv -f "$item" "$trash_dir/$item_name $current_time"
else
mv -f "$item" "$trash_dir/"
end
end
end
else
echo "No file(s) given to delete"
end
end