|That's not a bad idea but I think whether I try to use your recommendation or run with mine, I have the same issue. Here's a piece of my code:|
. . .
if not exist !D_DIR!\!cname!.zip (
move !cname!.zip !D_DIR!
rd !vname! /s/q ) else (
set /a n=n+1
ren !pname!.zip !cname!.zip
This code starts where the new zip file is created. I test to see if it exists in the destination folder - if it doesn't I move the zip file there. I do some cleanup work and then using a FOR statement I grab the next file to process. When/If I hit a file that does exist in the destination folder, the ELSE code above gets triggered. This code does rename FILENAME.ZIP to FILENAME1.ZIP, and so on until it finds a unique sequential filename# as I want. Unfortunately once the ELSE code is triggered, the batch file QUITS after processing this one file. I am not sure how to tell it to return to the FOR command and grab the next file to process.
I think my problem has to do with using goto within a FOR statement, but I'm not sure how else to do this. Can a CALL to a batch file be used instead? What would that syntax look like?