views:

1363

answers:

2
pkzip25 -add=all -dir=current -silent -locale -exclude=DistData.zip -exclude=extract.bat -exclude=run.bat -exclude=pkzip25.exe -exclude=extracted.txt -exclude=zipped.txt -exclude=.\STORE DistData.zip *.*
pkzip25 -view -directories DistData.zip >zipped.txt

copy DistData.zip ..\BKX\DistData_1.zip
CD\BKX
rename DistData_1.zip DistData_2.zip 
rename DistData_2.zip DistData_3.zip
rename DistData_3.zip DistData_4.zip
rename DistData_4.zip DistData_5.zip
+2  A: 
rename DistData_1.zip DistData_2.zip 
rename DistData_2.zip DistData_3.zip
rename DistData_3.zip DistData_4.zip
rename DistData_4.zip DistData_5.zip

Is wrong, you have to use the opposite order and delete the last one first:

del DistData_5.zip
rename DistData_4.zip DistData_5.zip
rename DistData_3.zip DistData_4.zip
rename DistData_2.zip DistData_3.zip
rename DistData_1.zip DistData_2.zip

and maybe also move DistData.zip instead of copy, so it does not exist if you create a new zipfile.

move DistData.zip ..\BKX\DistData_1.zip

But I don't know if this was your question/problem.

Edit: If you want to keep 5 zipfiles (instead of 4), I suggest the following:

del DistData.zip >NUL 2>&1
pkzip25 -add=all -dir=current -silent -locale -exclude=DistData.zip -exclude=extract.bat -exclude=run.bat -exclude=pkzip25.exe -exclude=extracted.txt -exclude=zipped.txt -exclude=.\STORE DistData.zip *.*
pkzip25 -view -directories DistData.zip >zipped.txt

move DistData.zip ..\BKX
cd ..\BKX
del DistData_5.zip
rename DistData_4.zip DistData_5.zip
rename DistData_3.zip DistData_4.zip
rename DistData_2.zip DistData_3.zip
rename DistData_1.zip DistData_2.zip 
rename DistData.zip DistData_1.zip

This way you always have 5 backup copies.

Wimmel
A: 

Thank Wimmel I have tried MOVE but what happens is that 1 is then gone moved, which I dont want happening... xp will not alow me to force ? rename a existing file... What happens is the batch must run every 6 hours and each zipped file carries 2 hours intervals so lost of data will be minimal should the client experience file corruption. Had this working well in Win95. I'm really stuck on this one.... Would appreciate all the help I can get...

1 still exists, but is immediately renamed to 2. But I will update my post explaining how to avoid this.
Wimmel
@Trevor: Could you clarify your requirements? Is there a limit on the total number of zip files to keep? Can you just insert a timestamp in the filename so as to avoid renaming?
Zach Scrivena