I know this gets beaten to death, but I can't find an example of what I'm trying to achieve.
Say I have a folder full of txt files named something like:
c:\tmp\john.1.2.3.abc8-test.txt
c:\tmp\sean.T2C3.abc8-something.txt
c:\tmp\billy.bob.S837.C3.abc8-whoknows.txt
I want to do a foreach statement on the directory and either remove "abc8", which they all have in common, + anything after it until the ".txt". If it's easier, I can keep the abc8, but I want to remove everything after it..no matter what is after it...but still keep the file extension of course.
So after I run the script it would look like:
c:\tmp\john.1.2.3.abc8.txt
c:\tmp\sean.T2C3.abc8.txt
c:\tmp\billy.bob.S837.C3.abc8.txt
Any suggestions? Thanks