Solved

Waiting for winzip to finish in batch file

Posted on 2003-11-04
7
2,365 Views
Last Modified: 2010-05-18
Hi,
In a batch file i do a load of copy commands then call command line winzip to zip it all up before doing other stuff. The problem is that Winzip "appears to have completed" before it ACTUALLY has. ie it creates an empty zip file then puts stuff in it and returns focus to the calling batch file before it has "truly" finished.
The way in which it works means that i cant wait for the EXISTENCE of the winzip file before executing the next command in the file as it exists right from the start.

I could put an arbitrary wait time in but this is a little inexact, especially as the no. of files in the winzip file could vary between a low number and a high number and it seems silly to have the batch file sit around for 5 minutes just as an arbitrary "it must have completed in this time" sort of way.

SO: HOW do i get the next command in the batch file to hold fire until winzip has TRULY completed.
0
Comment
Question by:mwoolger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 20

Assisted Solution

by:Dufo G. Belski
Dufo G. Belski earned 175 total points
ID: 9679802
Do you truly "call" winzip or just run another line in your batch file?  

If you create a separate batch file just to run your winzip actions (call it zip.bat), then add a line to your original batch:

call zip.bat

it will execute your winzip commands to completion before returning to the next command in your original batch.
0
 

Author Comment

by:mwoolger
ID: 9679887
I can give that a try but my concern is that what is the difference between putting a command in a separate batch file and waiting for that to complete as apart to just having the line in the main batch file?

0
 

Author Comment

by:mwoolger
ID: 9679947
as a help, the full scenario is: from oracle plsql i kick off this batch file and need to check as to when it has finished. when it does i then do an operation which requires the file to be there and "completed". the problem is that any check i can think of (even taking a copy of the zip file) appears to plsql to have completed before it truly has.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 84

Assisted Solution

by:oBdA
oBdA earned 150 total points
ID: 9680138
I couldn't reproduce that here with the command line winzip; it displays the zipping progress as it should and doesn't pass on to the next line while still packing.
Anyway, have you tried running it using start "" /wait <YourPath>\wzzip.exe ...?
0
 
LVL 16

Accepted Solution

by:
PaulCaswell earned 175 total points
ID: 9687127
There's a really useful command-line interface to WinZip called wzzip. It should solve all your problems. Just search for wzzip, there are loads of sources.

If you've already tried this and still have the same problem your system is probably spawning a command shell in its own thread so why not do two wzzips, one after the other. The second one should not be able to even start until the first one is complete, let alone finish. Then wait for the appearance of the second zip file.

0
 

Author Comment

by:mwoolger
ID: 9687231
Wzzip is what I am using. as it turns out its more of a problem in detecting when the batch file as a whole has finished. it seems to be working now that I have started using the C system function to start the batch file rather than starting it in a new thread. correspondingly i will split points between you all to be fair.
0
 

Expert Comment

by:Babbage
ID: 9702543
Why not use Good 'ol pkunzip.exe pkzip.exe they still work fine, anyone remember these?
It will run in the cmd/dos window and will run in order.

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
DOS string replace and remove character at end 3 82
command line argument to replace text in a file 4 68
For loop to add numbers 3 94
how to export this list 4 81
Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question