Script is ignoring files with square brackets?
LifeLifeLP opened this issue · 3 comments
hey man, great script its very helpful sorting files among large amounts.
here a 2 files that do not get moved, i have full perms on them so idk why they get ignored.
Microsoft Windows 98 Second Edition (4.10.2222) [German] (ISO).7z
Microsoft Works 8.5 [Ger].iso
I did some tests and it's a bug. I investigated and the problem is here if (Test-Path -Path $f -PathType Leaf )
I don't know why Test-Path don't recognize files with square brackets. I did tests with curly brackets and special characthers and all is ok. The problem show up only with square brackets. I'll investigate more and I'll try to make a fix,
Thanks for your feedback!
Hi, in order to fix it, you should replace -Path
with -LiteralPath
and add quotation marks so square brackets are not interpreted as escape characters.
I fix the bug and uploaded a new version 0.3.1 with -LiteralPath
. Now it works with square brackets too.
Thanks for your help.