Вопрос

I have a folder full of .html files that i am trying to rename, but I want to keep the existing name as part of the new name, and I'm having trouble because of the new filename format. I need them to go from:

filename.html

to

company.filename.pat.html

The result is the existing filename needs to be sandwiched in the middle of some periods, and thats throwing me foe a loop. Anyone have suggestions on how to archive this? Command line or powershell both work.

the "company" and "pat" parts will be the same for all files, so i dont need to account for any variations there, thankfully.

Thanks in advance!

Это было полезно?

Решение

Powershell

cd c:\yourdir\withfiles\
ls | % { ren $_.Name ( "company." + $_.BaseName + ".pat" + $_.Extension) }
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top