Files
mkdocs/docs/macos/terminal/trash.md
2023-11-14 20:35:51 +01:00

83 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# trash
### trash
http://hasseg.org/trash/
```bash
brew install trash
```
```bash
trash <file>
```
### macos-trash
https://github.com/sindresorhus/macos-trash
```bash
brew install macos-trash
```
```bash
trash <file>
```
###
### AppleScript
```bash
osascript -e "tell application \"Finder\" to delete POSIX file \"${PWD}/${InputFile}\""
```
```bash
trash() (
: "${1:?}"
case $1 in
(/*) FNAME="$1" ;;
(*) FNAME="$(pwd)/$1"
esac
export FNAME
exec osascript <<-EOF >/dev/null
set fName to system attribute "FNAME"
tell application "Finder" to delete my (POSIX file fName)
EOF
)
```
```bash
function rem {
for b in "$@"
do
osascript -e "tell app \"Finder\" to delete POSIX file \"${PWD}/$b\""
done
}
```
```bash
trash() { mv -fv "$@" ~/.Trash/ ; }
#
```
```
/Volumes/Sharon/Windows trash Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx
copied 'Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx' -> '/Users/bruno/.Trash/Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx'
removed 'Windows10_InsiderPreview_Client_ARM64_en-us_21354.vhdx'
/Volumes/Sharon/Windows 25s 09:06:33
```