I need to write a powershell script, which list file names that contains the same letters, only difference is the sort of the letters.
My first oppinion is to sort the letters in alphabet, and if it fit, then they match, but i need some help for do that
Get-ChildItem $path | foreach {$i=1}`
{
$asd=$_ | sort-object
Get-ChildItem $path | foreach {$i=1}`
{
$wasd=$_ | sort-object
if($asd -eq $wasd)
{
Write-Host $_
}
}
}
This files match for my criteria: asd.txt, dsa.txt, because contains same letters
I think this is doing what you want.