header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
-contains Always Equals False
Last Post 01 Sep 2010 07:40 PM by Roman. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Resolved
ealdersUser is Offline
New Member
New Member
Posts:1
Avatar

--
01 Sep 2010 02:33 PM
    I've got an array I populate with a change list of partial file paths.  I then recurse the file directory to find if any of those items are contained in the array.  For some reason the -contains operator always returns false even when it should match.  The line of Powershell is below:

    dir -recurse $FolderDirectory -include .txt | where { $changeList -contains ([regex]::Replace($_.FullName, $filepathRegex, '$1').Trim()) }

    I don't know if anyone has encountered this issue or can point me in the right direction.

    Thanks
    RomanUser is Offline
    New Member
    New Member
    Posts:1
    Avatar

    --
    01 Sep 2010 07:40 PM
    Just tossing out guesses, but what if you write *.txt and could it be that the trim statement should be ([regex]::Replace($_.FullName, $filepathRegex, '$1')).Trim() in order to trim the whole thing?
    Other than that, without a clue as to what is in your variables, that's all I got.
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer