File tree Expand file tree Collapse file tree 1 file changed +0
-5
lines changed
Expand file tree Collapse file tree 1 file changed +0
-5
lines changed Original file line number Diff line number Diff line change 1414# @raycast.author Vicent
1515# @raycast.authorURL https://github.com/vigosan
1616
17- # Get selected files from Finder using AppleScript (using newline as delimiter)
1817selected_files=$( osascript << 'ENDAPPLE '
1918tell application "Finder"
2019 set selectedItems to selection
@@ -33,19 +32,15 @@ end tell
3332ENDAPPLE
3433)
3534
36- # Check if any files are selected
3735if [ " $selected_files " = " NO_SELECTION" ]; then
3836 exit 1
3937fi
4038
41- # Convert the text list to array (AppleScript returns newline-separated paths)
4239files=()
4340while IFS= read -r line; do
4441 [[ -n " $line " ]] && files+=(" $line " )
4542done <<< " $selected_files"
4643
47- # Move each file to trash using AppleScript
4844for file in " ${files[@]} " ; do
49- # Move to trash using AppleScript (this is the native macOS way)
5045 osascript -e " tell application \" Finder\" to delete POSIX file \" $file \" " > /dev/null 2>&1
5146done
You can’t perform that action at this time.
0 commit comments