I have a large number of files with names like this in a same folder:
- myPic_fr.png
- myPic_it.png
- myPic_gr.png
I want to rename them to:
- myPic_fr_1080.png
- myPic_it_1080.png
- myPic_gr_1080.png
Then copy them to a new folder like this:
- ../fr/myPic_fr_1080.png
- ../it/myPic_it_1080.png
- ../gr/myPic_gr_1080.png
How to create a batch script or powershell script to do that job?
Edit: I tried this batch script code to do the rename job (Thanks @RoXX):
@echo off
setlocal EnableDelayedExpansion
SET oldPart=.png
SET newPart=_1080.png
for /f "tokens=*" %%f in ('dir /b *.png') do (
SET newname=%%f
SET newname=!newname:%oldPart%=%newPart%!
move "%%f" "!newname!"
)
But for the "copy" part I don't know how to do it! Maybe need Regex?
Thanks