0

I've got a user that creates multiple exported sets of textures from a visual editing program he uses daily. When these export the filenames come out with a pattern of "texture*" (e.g. texture_43522, texture511235, texture-341231).

What my user needs is a script he can run in one of these exported directories to add the letter "b" to the end the word texture so that he can import these textures properly into the next step of his workflow. (e.g. textureb_43522, textureb511235, textureb-341231)

I found a similar question here: similar question, replacing "-" with "_" but I am not well versed in batch scripting and am unable to figure out how to inject the pattern "texture" into the script instead of the dash.

Any guidance, reference, or code samples are welcome.

EDIT:

A solution I wound up using:

Get-ChildItem -Filter "*texture*" -Recurse | Rename-Item -NewName {$_.name -replace 'texture','textureB' } 

Please look at nixda's answer below and use the one best for your situation

1 Answers1

0

I hope PowerShell as CMDs successor is ok

Dir D:\test | Where {$_ -notmatch '^textureb' } | ForEach {
    Ren $_.Fullname $_.Name.Replace('texture','textureb')
}
nixda
  • 27,634