bdukes / PowerShellModules

A collection of PowerShell modules
Apache License 2.0
44 stars 9 forks source link

Remove-ItemSafely -LiteralPath does not work w/ special characters (brackets, backticks,...) #2

Closed flolilo closed 6 years ago

flolilo commented 6 years ago

This is the issue to my Pull request #1 .

Hello! Thanks for your effort with these nice modules. However, I encountered an error:

    $foo = @(Get-ChildItem -File | Select-Object -ExpandProperty FullName)
    $foo | ForEach-Object {
        Remove-ItemSafely -LiteralPath $_
    }

Does not work if files have backticks, brackets, or spaces in their name:

> Get-Item : Cannot find path
> At C:\Program Files\WindowsPowerShell\Modules\Recycle\1.0.2\Recycle.psm1:93 char:13
> +    $item = Get-Item $Path
bdukes commented 6 years ago

This has been published as https://www.powershellgallery.com/packages/Recycle/1.1.0