I'd like to ask a question about removing lines from a variable that has strings obtained from get-childitem. Right now, I'm extracing lines indicating files with this :
$FolderToOpen= Get-ChildItem -Path $SrcDir -Filter *.$ExtLst
That gets the files from a specified folder and specified extensions Then, I get 4 random lines from that variable
$FourFiles = $FolderToOpen | Get-Random -Count 4
But then, here's my problem, I'd like to delete those 4 lines from the first variable. However I can't get to do that, doing
$FolderToOpen -replace "$FourFiles",""
for exemple doesn't do anything. Could someone help me please? Thank you in advance :)