confOS/.config/fish/functions/trash-empty.fish
2024-11-04 17:22:51 +01:00

18 lines
549 B
Fish

function trash --description "Empty the windows recycle bin."
# Get function name
set current_name $(status current-function)
# Check if no arguments were provided
if test -z $argv[1]
echo -e "Usage: $current_name"
return 0
end
# Empty trash
powershell.exe -Command "" \
"\$bin = (New-Object -ComObject Shell.Application).NameSpace(10);" \
"\$bin.items() | ForEach {" \
" Write-Host 'Deleting:' \$_.Name;" \
" Remove-Item \$_.Path -Recurse -Force;" \
"}"
end