powershell - Pull Specific 10 digit string from filename -


most of our files named in uniform syntax:

b0????????.????.??????.jpg 

however occassionaly see:

?????.b0????????.????.jpg 

or

?????????.b0????????.jpg 

i need powershell script pull 'b0' , next 8 digits. traditionally have trimmed string when file names uniform, failing these variations.

does have bit of ps logic can pull 'b0' , next 8 digits string/filename?

thanks!

$file = "?????.b0????????.????.jpg" $index = ($file).indexof("b0") $yourcharacters = ($file).substring($index, 10) $file.replace($yourcharacters, "") 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -