i have a bunch of *.CSV Files. Huge *.CSV Files. I try to search for a specific pattern in these Files called "Secure". If found, the script shall copy it to a folder.
It works, but it has one Problem i could'nt solve. In some files, the Word i'm looking for is present more than once. Now my script searches for the word, finds it and copies it. Then it searches in the same file again, finds the pattern again and copies again.
But it should copy after the first find of the word and then search in the next *.CSV file and not in the same again.
i tried a bunch of things "-SimpleMatch
" or "-First 1
"
the Code so far is :
Select-String -Path 'C:\Tools\Test\*\*.csv' -Pattern "Secure" | Select -first 1 | Copy-Item -Destination C:\Tools\Found -Verbose
can someone help me ?
Thank you!
Aucun commentaire:
Enregistrer un commentaire