14-11-2023
This commit is contained in:
82
docs/macos/terminal/trash.md
Normal file
82
docs/macos/terminal/trash.md
Normal file
@@ -0,0 +1,82 @@
|
||||
# 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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user