diff --git a/.config/fish/functions/trash.fish b/.config/fish/functions/trash.fish index f54d5cd..32a414a 100644 --- a/.config/fish/functions/trash.fish +++ b/.config/fish/functions/trash.fish @@ -12,8 +12,8 @@ function trash --description "Move file or directory to the windows recycle bin. set file "$argv[1]" powershell.exe -Command "& {" \ " Add-Type -AssemblyName 'Microsoft.VisualBasic';" \ - " Get-ChildItem -Path $file | ForEach-Object {" \ - " if (\$_.GetType() -eq [System.IO.DirectoryInfo]) {" \ + " Get-ChildItem -Path '$file' | ForEach-Object {" \ + " if (\$_ -is [System.IO.DirectoryInfo]) {" \ " [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteDirectory(\$_.FullName, 'OnlyErrorDialogs', 'SendToRecycleBin')" \ " } else {" \ " [Microsoft.VisualBasic.FileIO.FileSystem]::DeleteFile(\$_.FullName, 'OnlyErrorDialogs', 'SendToRecycleBin')" \