I have many many files named like aaaaa.mxf I wish to have them named aaaaa.j2k.mxf
the aaaa in this example is a big long number that varies in length.
I have limited success with
Dir *.mxf | rename-item -newname { [io.path]::ChangeExtention($_.name, “j2k.mxf”) }
my problem is These files go into a dir and I wish to update it daily
so - with the above solution
monday works fine but on tue the monday load gets aaaa.j2k.j2k.mxf etc etc.
so i need a IF or something that …maybe uses -no_match
basically like
If instring is NOT already j2k.mxf
then
Dir *.mxf | rename-item -newname { [io.path]::ChangeExtention($_.name, “j2k.mxf”) }
I have tried some things … all so far off that I hesitate to mention.
You don’t necessarily need an IF, you can just exclude files currently named with j2k.mxf. You should validate it’s working as expected with -WhatIf and then you can remove it to actually make changes. Try something like this: