1.

Solve : using wzzip in batch file?

Answer»

Hello there, first time posting here, in HOPES someone can help resolve my frustration...

I have a small batch file that I have I am using to zip a folder, then copy to a directory that is backed up nightly. However I am am not able to get the zip utility to create and add files to the zip file.

I am using wzzip, with winzip version 10. According to the help file with wzzip, I should be able to add the "-a" option in the line to add files. But this is also so assumed, so I have tried it both ways. But adding the option gives an error when the batch is ran. So this is my first clue. I also have added the wildcard *.* at the end of the line according to the reference and it is not appending the file. Here is what I have written

@echo off


start /MIN "c:\program files\winzip\wzzip" c:\backup\ffbackup\ffbackup.zip *.*

start /MIN "c:\program files\winzip\wzzip" -a c:\backup\ffbackup\ffbackup.zip *.* (causes an error in the batch if i leave this)

xcopy /s /y /v c:\backup\ffbackup\ffbackup.zip /i z:\backup\ffbackup

for /f "tokens=1-5 delims=/ " %%d in ("%date%") do rename "z:\backup\ffbackup\ffbackup.zip" %%e-%%f-%%g.zip

end

I am a rookie when it comes to writing the batch files, and also not too experience with wzzip. but I am able to get the files to copy and all the good jaz....any help would be appreciated!

Time was invented to prevent everything from happening at once.

Here you've got two copies of wzzip running in separate windows, a copy of xcopy running in the original window, and all the programs NEED control of ffbackup.zip.

Try slowing events down by running the job steps serially:

Code: [Select]"c:\program files\winzip\wzzip" c:\backup\ffbackup\ffbackup.zip *.*

"c:\program files\winzip\wzzip" -a c:\backup\ffbackup\ffbackup.zip *.*

xcopy /s /y /v c:\backup\ffbackup\ffbackup.zip /i z:\backup\ffbackup

for /f "tokens=1-5 delims=/ " %%d in ("%date%") do (
rename "z:\backup\ffbackup\ffbackup.zip" %%e-%%f-%%g.zip
)

no i only wrote the following line in my previous post as an example of what else i have tried.

i dont run the batch with both lines... I have tried either one or the other...

"c:\program files\winzip\wzzip" -a c:\backup\ffbackup\ffbackup.zip *.* (causes an error in the batch if i leave this)



Quote

causes an error in the batch if i leave this

What error? Did the wzzip program issue the error? The syntax you posted is correct. I was able to duplicate your Winzip code with no problems.

well when I put the line in with he -a option it will give a message"cannot fine -a"

that throws me because I was following the instructions from the help file

and I STARTED to suspect that it was not actually appending the zip file, because the properties did not show that the file had been changed.



I added a test txt file in the directory that was supposed to be zipped, and the test file was not listed...

yea its driving me crazy, I had perused the help section that came with wzzip for a couple of days before posting here...


thank you for your help!
err, cannot find -aDOS usually takes arguments in the for /* not -* but if the documentations says so....I've tried short path names, long path names, quotes, no quotes and I cannot get your code to fail. The -a switch is the DEFAULT, so why not eliminate it?

Code: [Select]"c:\program files\winzip\wzzip" c:\backup\ffbackup\ffbackup.zip *.*

If you can, turn off echo in your batch file, run from the command prompt and post any output to the console.

I'm having a hard time fixing something that is not broke. well maybe I misunderstand what the behavior of wzzip is supposed to do.

perhaps this is a test grasshoppa

basically it still seems my batch is only copying the existing zip file (residing in \c:\backup\ffbackup\), and not creating another one and copying that...

that is ultimately what I am wanting to accomplish.
I'm confused. Are you having problems with wzzip syntax or are you getting unexpected results. There is a difference.

Quote
basically it still seems my batch is only copyinarchiveg the existing zip file (residing in \c:\backup\ffbackup\), and not creating another one and copying that...

That would DEPEND on the source files. The -a switch will add new files to the archive. Use the -f switch to replace files that are already part of the Zip file and are newer on disk. Use the -u switch to add to the archive any files that are not already in the Zip file, and replaces any files that have a more recent date on disk.

Code: [Select]"c:\program files\winzip\wzzip" -u c:\backup\ffbackup\ffbackup.zip *.*
for /f "tokens=1-5 delims=/ " %%d in ("%date%") do (
copy /y /v c:\backup\ffbackup\ffbackup.zip %%e-%%f-%%g.zip
)
The above code produces two copies of the archive. One on c: and one in the current directory.

Code: [Select]for /f "tokens=1-5 delims=/ " %%d in ("%date%") do (
"c:\program files\winzip\wzzip" -u %%e-%%f-%%g.zip *.*
)
The above code simplifies the process, creating one zip file in the current directory.



Note to Self: In the next lifetime, come back as a dentist.


Great, I have briefly tested and think I see where you have made improvements. I will have to play with it a bit more, but you're giving me a push in the right direction.

I was under the impression that I had to put the start line in the batch to launch the app.

I hope I havent added any grey hairs, or shortened your life span any


Discussion

No Comment Found