Link to home
Start Free TrialLog in
Avatar of SewellM
SewellM

asked on

Overwrite file automatically when unzipping

I have a customer that FTP's down a file from our server.  This is a zip file.  They then unzip the file and overwrite the old copy.  They perform this daily.  What I need is the ability to unzip the file without prompting to overwrite.  I am currently using pkzip command line to zip the file, but can change if necessary.

Thanks
Michael
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

If you're overwriting the files, why not just have a script that first deletes them.  Thus no overwrite and no prompt.
Avatar of mesach
mesach

I use WinRar for compression and find that it gets better compression, you can save it as a zip file if you need to(i dont know the command line for that but here is one possible answer to your question

to overwrite the command you would use is

rar e -o+ document.zip c:\path\where\you\want

the -o+ signifys the over write command
After having just test it Winzip with the CLI works also but if you do not have the full(purchased) version it pops up a disclaimer that makes you hit any key to continue

the Syntax is

wzunzip -o file.zip C:\path\to\where\you\want\to\unzip

pkzip isnt giving out any free test versions of the pkzip for dos any more or i would test that.
Avatar of SewellM

ASKER

OK, I need to be clearer.  I create the recordlist.txt file using SQL DTS and copy the file to a seperate server.  The recordlist.txt file is then zipped up using PKZIP to create a self executing executable (via a batch file), and the zip file is loaded to the ftp server.  All of this works fine and is in my control.
The customer then downloads the file to their machine.  They then double click (from windows) on the self executing zip file.  ** Important part here **  When the zip file attempts to extract the recordlist.txt file, it finds an existing copy of recordlist.txt.  It then displays an alert about overwriting the file and the customer has to select yes. (This is what the customers want removed.  They want to double click and have the .txt file copied to the current folder without any more interaction. )
Customers may load the file anywhere they like, so a specific path is out of the question.  
I have no control over the method of extraction, so I use a self extracting zip.
I have tried most of the switches for pkzip when creating the file and have no luck.  I have looked into winzip and could use it if it accomplishes my needs.  I just need to extract the file without any user interaction beyond double clicking the SEP.

Michael
With PKZIP, you can tell to with the '-o' option, but I'm not sure if you can force this option when creating the archive file. That's what you will have to use a self extracting file for users.

Anyway, you can do it with Windows version of Winzip if you would mind use this software (it's not free).
You can take a look here http://www.gail-wilson.com/winzip.htm, and you will find that you have to check an option "overwrite by default" when creating the self extracting file.
The only issue is whether the Winzip CLI (Command Line Interface) will let you do it in batch mode or not ?
ASKER CERTIFIED SOLUTION
Avatar of mesach
mesach

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
wow i split my thoughts up disreguard the

"to do it in CLI

wzunzip -o file.zip C:\path\to\where\you\want\to\unzip"

part i was thinking half thoughts
Avatar of SewellM

ASKER

Got it to work, it just took 2 steps.  Used winzip.  Created the zip (from a batch file).  Created the self extracting executable from the command line add-on using the zip file.
wzipse32 zipfile -d . -auto -y -overwrite
The . signifies to unzip into the current directory.
Avatar of SewellM

ASKER

Thanks for the help mesach, you pointed me in the direction to get this issue resolved.

Michael