Solved

batch file

Posted on 2004-09-24
15
1,611 Views
Last Modified: 2010-05-18
id like to be able to have winzip grab a folder each night and zip the it automatically.

The folder is about 11G in size and is at c:\backup

I would like it to be saved as c:\backupfolder.zip

Can a batch file be written to do this?

Thanks
0
Comment
Question by:mmacdougall
  • 4
  • 4
  • 2
  • +1
15 Comments
 
LVL 15

Accepted Solution

by:
Yan_west earned 168 total points
ID: 12147255
Download a dos compression software like ARJ..

http://www.uv.tietgen.dk/staff/mlha/Download/DOS/arj/250a/arj250a.exe

Then,

create a batch file, and write

arj a test.arj c:\test\*.*
exit

save it as compress.bat

go in your control pannel, and create a new scheduled task calling this batch file at whatever hour you want.

That's it.


0
 
LVL 6

Expert Comment

by:tanelorn
ID: 12147256
how big will the zip file be?  I've used the command line interface add on for winzip and it works pretty well.  

a batch file can be written.  you will need to download and install the winzip command line addon.

I think you might run into the 4GB size limit and/or a 65535 file limit for your zipped file though.  

Tanelorn

0
 
LVL 15

Expert Comment

by:Yan_west
ID: 12147257
btw, you can change the name of test.arj and the path to whatever you want :)
0
 
LVL 6

Expert Comment

by:tanelorn
ID: 12147273
if you can seperate your heirarchy a little, you can get around the file size limit.



T
0
 

Author Comment

by:mmacdougall
ID: 12147290
I know there was a 4GB size limit to the older version of Winzip, but I just downloaded and zip the 11Gb folder with Winzip 9
0
 
LVL 6

Expert Comment

by:tanelorn
ID: 12147379
hhmm  

http://www.winzip.com/prodpagecl.htm

I just read it,  they do have the command line add-on,  without the limitations..  this will work for you..

I would follow Yan_West's suggestion for putting your file in the scheduled tasks.

T
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Assisted Solution

by:tanelorn
tanelorn earned 166 total points
ID: 12147400
seems that you have to have a valid license for winzip  for the command line stuff to work though..

if you own it already,  you are golden.  otherwise you will have to buy.  I don't know anything about arj,  it may be worth looking at if it does not have a file-size and capacity problem..

T
0
 
LVL 38

Expert Comment

by:BillDL
ID: 12150033
Direct download link for the WinZip version 9 command line add-in:

http://download.winzip.com/wzcline.exe

This is WinZip(R) Command Line Support Add-On Version 1.1 SR-1 (Build 6224) which requires WinZip 9.0 or later and Win 98, Me, NT 4.0, 2000 or XP.  Full documentation is in the WZCLINE.HLP file once the .exe is unzipped.

I downloaded the one for version 8.0 (Version 1.0 (build 3181)) a while back and still use it.  You can pick it up at this link, but the zip file is password protected with MY Experts Exchange login name - so take a note of it.

http://client.henninger.com/pickup/learning/Winzip8_CommandLineAddOn.zip

Just run "Setup.exe" once unzipped to its own folder.

The 2 DOS Executables that do the work after installation are WZZIP.EXE and WZUNZIP.EXE.

I wonder if they will work on their own without installing?  Must try this by copying them to C:\Windows\Command in my Win98 system.

WZZIP and WZUNZIP will in most cases return a nonzero errorlevel in the event of a serious error; otherwise, an errorlevel of 0 is returned. You can use these return codes in batch files and other automated processing.  For example:

wzzip filename.zip *.doc
If Not ErrorLevel 1 Goto Exit
Echo ***SERIOUS ERROR DETECTED***
:Exit

Bill
0
 
LVL 38

Expert Comment

by:BillDL
ID: 12150046
0
 
LVL 38

Assisted Solution

by:BillDL
BillDL earned 166 total points
ID: 12152461
No, PKZIP 2.04g doesn't create or allow you to use long filenames.  Strangely enough though, the command options are so sililar that it makes me wonder if WinZip maintained a set standard to keep old-timers happy, or just deliberately plagiarised PKZIP.

WinZip Command Line Add-On CAN work in standalone mode, but there's no real sense in doing this as it installs to the directories already created by WinZip which it needs to work.  It can't run in DOS from the .EXE files as it requires a couple of .DLL's.  It doesn't add very many registry whereby it would only need a very small .reg file to add the settings, but again not much sense.

Program Folder created by version 8.0 Installer if not already present:
C:\Program Files\WinZip\

Files copied to it:

Readmecl.txt
Wzcline.hlp
Wzcline.Ccnt
WZZIP.EXE
WZUNZIP.EXE
Wzcline.dll
Wzclun.dll
Wzcl32.dll

Registry

REGEDIT4

[HKEY_CURRENT_USER\Software\Nico Mak Computing\WinZip\Add-Ons]

[HKEY_CURRENT_USER\Software\Nico Mak Computing\WinZip\Add-Ons\WZCLINE]
@="C:\\Program Files\\WinZip\\wzclun.dll"

[HKEY_USERS\.DEFAULT\Software\Nico Mak Computing\WinZip\Add-Ons]

[HKEY_USERS\.DEFAULT\Software\Nico Mak Computing\WinZip\Add-Ons\WZCLINE]
@="C:\\Program Files\\WinZip\\wzclun.dll"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\wzunzip.exe]
@="C:\\Program Files\\WinZip\\wzunzip.exe"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\wzzip.exe]
@="C:\\Program Files\\WinZip\\wzzip.exe"

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\WZCLINE]
"DisplayName"="WinZip Command Line Support Add-On"
"UninstallString"="C:\\Program Files\\WinZip\\winzip32 /auninstall wzcline"

Sample batch file (for Windows 98) that assumes the command-line addons to have been installed or copied to the correct folders, and tests for the existence of them first.

Assumes your files to be backed up are in C:\BACKUP
Assumes the batch file to be in the root of your C:\ Drive
Will create BACKUP.ZIP to the root of your C:\ Drive.

It's long-winded, but this is deliberate to show the syntax.

--------------------------------------------------------

@echo off
::
:: Read the help section at the end for details
::
:: BillDL
::
set DOSDIR=c:\windows\command
set WZDIR=c:\progra~1\winzip
set SOURCE=backup
set DEST=backup.zip
set DEST1=backup_old.zip
if not exist %SOURCE%\NUL goto NOSOURCE
if not exist %SOURCE%\*.* goto NOSOURCE
::
:: Tests for existence of executables needed for
:: menu option 3.  If any of these are not where
:: expected, then this menu option will not show.
::
:CHECK1
echo check 1
pause
if not exist WZUNZIP.EXE goto CHECK2
goto CHECK3
::
:CHECK2
echo check 2
pause
if not exist %WZDIR%\WZUNZIP.EXE goto MENU2
goto CHECK4
::
:CHECK3
echo check 3
pause
if not exist FC.EXE goto CHECK4
goto OPTIONS
::
:CHECK4
echo check 4
pause
if not exist %DOSDIR%\FC.EXE goto MENU2
goto OPTIONS
::
:MENU2
cls
echo.
echo.
echo                   BACKUP MENU
echo                   ===========
echo.
echo             1. Overwrite existing backup zip file
echo             2. Add new files to backup zip file
echo             3. (Option Disabled)
echo             4. Same as 2 but non-interactive
echo             5. Help
echo             Q. Exit
echo.
echo             Select an option within 15 seconds ...
echo.
choice /c:12345q /N /T:q,15
if errorlevel 6 goto END
if errorlevel 5 goto USAGE
if errorlevel 4 goto AUTO
if errorlevel 3 goto NOEXE
if errorlevel 2 goto FRESHEN
if errorlevel 1 goto REPLACE
::
:OPTIONS
cls
echo.
echo.
echo                   BACKUP MENU
echo                   ===========
echo.
echo             1. Overwrite existing backup zip file
echo             2. Add new files to backup zip file
echo             3. Same as 2 but check backup file
echo             4. Same as 2 but non-interactive
echo             5. Help
echo             Q. Exit
echo.
echo             Select an option within 15 seconds ...
echo.
choice /c:12345q /N /T:q,15
if errorlevel 6 goto END
if errorlevel 5 goto USAGE
if errorlevel 4 goto AUTO
if errorlevel 3 goto SAFEBAK
if errorlevel 2 goto FRESHEN
if errorlevel 1 goto REPLACE
::
:REPLACE
::
WZZIP -a -ex -o -p -r -Jhrs -whs -z %DEST% %SOURCE%\*.*
echo.
echo       *** Backup Complete ***
echo.
echo       Press any key to return to options...
echo.
PAUSE>NUL
goto MENU2
::
:FRESHEN
WZZIP -u -ex -o -p -r -Jhrs -whs -z %DEST% %SOURCE%\*.*
echo.
echo       *** Backup Complete ***
echo.
echo       Press any key to return to options...
echo.
PAUSE>NUL
goto MENU2
::
:SAFEBAK
cls
echo.
echo.
::
:: Test integrity of zipped archive by running a test
:: Using WZZIP to list files that WOULD be packaged.
:: WZZIP then physically creates the zip file.
:: WZUNZIP is then run in test mode to output a list
:: of files that WOULD be extracted from the zip file.
:: DOS FC.EXE is then run with an ASCII comparison
:: to compare both of the files.
:: This menu option will NOT be available if either
:: FC.EXE or WZUNZIP.EXE do NOT exist where expected.
::
rem set EXTTEST=testfolder
if exist %EXTTEST% deltree /Y %EXTTEST%
rem md %EXTTEST%
set ZIPLIST=filelist.txt
set UNZIPLIST=testlist.txt
set TMPCOMP=results.txt
WZZIP -u -ex -o -p -r -Jhrs -whs %DEST% -@%ZIPLIST% %SOURCE%\*.*
WZZIP -u -ex -o -p -r -Jhrs -whs -z %DEST% %SOURCE%\*.*
WZUNZIP -d -Jhrs -o -yo %DEST% -@%UNZIPLIST% %EXTTEST%
pause
FC /A /C /L /LB10 /W filelist.txt testlist.txt > %TMPCOMP%
find /I "no differences encountered" %TMPCOMP%>NUL
if errorlevel 1 goto NOTSAME
cls
echo.
echo.
echo             ** FILES MATCH **
echo.
echo.
echo       Press any key to return to the menu...
echo.
PAUSE>NUL
deltree /Y %EXTTEST%
del %ZIPLIST%
del %UNZIPLIST%
del %TMPCOMP%
rem set EXTTEST=
set TMPCOMP=
set ZIPLIST=
goto MENU2
::
:NOTSAME
cls
echo.
echo.
echo             *** FILE MISMATCH **
echo.
echo             It looks like not all files were zipped
echo             successfully.
echo             Suggestion:
echo             Quit and delete the file %DEST% then
echo             try and run it again from another option.
echo.
echo             Press any key to return to the menu...
echo.
PAUSE>NUL
deltree /Y %EXTTEST%
del %ZIPLIST%
del %UNZIPLIST%
del %TMPCOMP%
rem set EXTTEST=
set TMPCOMP=
set UNZIPLIST=
goto MENU2
::
:AUTO
if exist %DEST% copy %DEST% %DEST1% /Y
WZZIP -u -ex -o -p -r -Jhrs -whs -ybc %DEST% %SOURCE%\*.*
if exist %DEST1% del %DEST1%
goto END
::
:USAGE
cls
echo.
echo.
echo USER OPTIONS
echo ============
echo.
echo Option 1. Overwrites the backup file %DEST% with a new one
echo created from all files in the folder %SOURCE% after it has
echo made a backup named %DEST1%
echo.
echo Option 2. Selects all files from the folder %SOURCE%
echo but only adds new files or more recent files if already packed.
echo.
echo Option 3. Same as option 2, but checks integrity of zip file by
echo performing test runs on it to create output files to compare.
echo.
echo Option 4. Same as option 2, but no prompts. Terminates after run.
echo.
echo Option 5. No need to explain, you got here from that option.
echo.
echo Option Q. Needs no explanation.
echo.
echo       Press any key to return to the options...
PAUSE>NUL
goto MENU2
::
:NOEXE
cls
echo.
echo.
echo       *** Option 3 has been disabled ***
echo.
echo       This option requires that FC.EXE is either
echo       in the same folder as this batch file or
echo       in the %DOSDIR% folder.
echo.
echo       It also requires that WZUNZIP.EXE is either
echo       in the same folder as this batch file or
echo       in the %WZDIR% folder.
echo        It also assumes that the registry knows the
echo        program folder containing the required .dll's.
echo.
echo       Press any key to return to the menu...
echo.
PAUSE>NUL
goto MENU2
::
:NOSOURCE
cls
echo.
echo.
echo             ***  The folder %SOURCE% does not exist or is empty ***
echo.
echo                   Program Terminated
echo.
goto END
::
:END
cls
echo.
echo.
echo             ***  Program Terminated Normally ***
echo.
set DOSDIR=
set WZDIR=
set SOURCE=
set DEST=
set DEST1=

--------------------------------------------------------------

Is this helpful?

It's only the size limitation that worries me.

0
 

Author Comment

by:mmacdougall
ID: 12369031
please dont close the issue yet, i just haven't had time to revisit it
0
 
LVL 38

Expert Comment

by:BillDL
ID: 12611420
Thank you, TheLearnedOne and modulo
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now