1

Basically this I used FOR /R "C:\Source Folder" %i IN (*.png) DO MOVE "%i" "C:\Staging Folder" It worked flawlessly except that all of the .png files that I have are named exactly the same so when I execute it, it will keep asking if I want to overwrite it, how do I make it so the output name are in increment suffix?

testlol13
  • 13
  • 2

1 Answers1

1

You just need to add a counter. I started with 10000 and took the last four digits only (resulting in files like originalname-0001.png etc. Simply expand it if a max of 9999 seems a bit tight)

@echo off
setlocal enabledelayedexpansion
set counter=10000
FOR /R "C:\Source Folder" %%i IN (*.png) DO (
  set /a counter+=1
  MOVE "%%i" "C:\Staging Folder\%%~ni-!counter:~-4!%%~xi"
)
Io-oI
  • 9,237
Stephan
  • 1,678