2012-02-01 04:37:51 +00:00
|
|
|
#
|
|
|
|
# Moves directories and files to Trash.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
2012-01-19 03:02:23 +00:00
|
|
|
print -N "${@:a}" | xargs -0 osascript -e '
|
|
|
|
on run theFilePaths
|
|
|
|
tell application "Finder"
|
|
|
|
set thePOSIXFiles to {}
|
|
|
|
repeat with aFilePath in theFilePaths
|
|
|
|
set aPOSIXFile to aFilePath as POSIX file
|
|
|
|
if exists aPOSIXFile
|
|
|
|
set end of thePOSIXFiles to aPOSIXFile
|
|
|
|
end if
|
|
|
|
end repeat
|
|
|
|
move every item of thePOSIXFiles to trash
|
|
|
|
end tell
|
|
|
|
end run
|
|
|
|
' &>/dev/null
|
|
|
|
|
|
|
|
if (( $? != 0)); then
|
|
|
|
print "$0: failed to move one or more items" >&2
|
|
|
|
return 1
|
|
|
|
fi
|
2011-10-12 03:13:58 +00:00
|
|
|
|