Filename: usenet_PW_extractor.ps1
# initialize the items variable with the # contents of a directory $download_folder = Get-ChildItem -Path "E:\_userdata\michael\Downloads\Grabit Downloads" $PW_file = "E:\pw.txt" # delete existing pw, file Remove-Item $PW_file # enumerate the items array foreach ($item in $download_folder) { # if the item is a directory, then process it. if ($item.Attributes -eq "Directory") { # extrat PW from filename $item.Name -match "{{(?<content>.*)}}" $PW_result = $matches['content'] add-content -path $PW_file -value "$PW_result" #Write-Host $PW_result #Write-Host $item.Name } }