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
Post a Comment