Good morning.
I´m trying to inspect files on folders to watch if files are older than X days. It works pretty nice with one exception, folders that contains in the name "[ ]" are skipped. I´m using the following:
Get-ChildItem -Path $Data -Recurse -Force | foreach {
If ($_.GetType().Name -eq "FileInfo")
{
If ($_.LastWriteTime -lt $TestDate)
$Data, is a variable that keeps the path and is variying in a loop.
$TestDate is the X days limit date.
As I told, it works fine wit folders with special characters in the name ($, %, &. _, etc), but if contains "[ ]" ("c:\Jimmy [Neutron] rules\" as example), the folder is skipped.
Why could be happening this?, and the really important matter, Is there any way to "fix" it?
Thank you.