Extract certain text from file path - Export to text file

Hello, just looking for some help new to powershell, I have folder with file names listed as the following “VPRTransac-GC02-MSGID0498857057-2021-06-07T09h00m00s021ms”

What I want to do is recursivly go through the folder extracting just the “MSGID0498857057” section and exporting this to a text file. Please could someone point me in the write direction for this, all files are the same length.

The caviat to this I only want it to run on the ones that start with “VPRTransac”

Many Thanks

Welcome to the forums.

Even for folks new to PowerShell or scripting we expect you to do your own research first and try to solve your problem in the first place before you come here to ask for help.

What you’re asking for is a quite comman task and has been asked and answered several times not just here on PowerShell.org.

To get you started you should read the help including the examples for the following cmdlets.

1 Like