Vojtěch Roul
Vojtěch Roul

Reputation: 23

batch save but not overwrite

I need to modify a .bat file from scanner which starts scanning and after save file to directory. c:\Data\scan1.tif

Now this script always overwrites the old file, I want to change it and save that file without overwriting in format like: scan1_1.tif, scan1_2.tif scan1_3.tif etc.

code from .bat:

call DirectScan.Bat -config c:\Scanner\directscan1.xml -cs1 c:\Data\scan1.tif

Upvotes: 2

Views: 85

Answers (1)

npocmaka
npocmaka

Reputation: 57242

Not tested:

set /a c=1
for /f "tokens=2 delims=._" %%a in ('dir /b "c:\Data\scan1*tif"') do set/a c=c+1

call DirectScan.Bat -config c:\Scanner\directscan1.xml -cs1 c:\Data\scan1_%c%.tif

Upvotes: 1

Related Questions