Solved

Dos command to compress a large text file using zip or rar

Posted on 2006-06-18
12
901 Views
Last Modified: 2008-01-16
my batch file has the commands:

set Filename=DATABASE_%date:~-4%%date:~-7,2%%date:~-10,2%.sql
c:\mysql\bin\mysqldump -u root mydb > %Filename%

This creates a backup file each day. The files are over 100mb so disk space is disappearing fast. When I zip the file it shrinks to only several mb. This is more manageable, so how do I automate winzip or winrar to archive and delete the file?

Thanks


0
Comment
Question by:craigdev
[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
  • 3
  • 2
  • 2
  • +4
12 Comments
 
LVL 96

Assisted Solution

by:Lee W, MVP
Lee W, MVP earned 100 total points
ID: 16931871
Frankly, I use the free InfoZip "zip.exe" command - that would simply be:

zip -9 %filename%.zip %filename%

based on your example
http://www.info-zip.org/
0
 
LVL 10

Assisted Solution

by:GuruGary
GuruGary earned 50 total points
ID: 16931873
If you have the registered version of WinZip Pro, it does support a command-line interface that is quite powerful.  You can download it from http://www.winzip.com/prodpagecl.htm, and the command line would probably be something like:

set Filename=DATABASE_%date:~-4%%date:~-7,2%%date:~-10,2%.sql
c:\mysql\bin\mysqldump -u root mydb > %Filename%
wzzip.exe -a DATABASE_%date:~-4%%date:~-7,2%%date:~-10,2%.zip %Filename%
0
 
LVL 14

Expert Comment

by:Hamidreza Vakilian
ID: 16937200
Hi!

You can use PKware Utility for ms-dos.
(Both PKZIP and PKUNZIP)

{
PKZIP -& -rp A:DIR
PKUNZIP -d A:DIR
}

HRV
0
[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 16937243
PKZIP is NOT free - that's why I recommend infozip, which is. Also, the 16 bit pkzip program has limitations and the newer one from PKWare is a time limited trial.
0
 
LVL 14

Expert Comment

by:Hamidreza Vakilian
ID: 16940458
I don't think so... just take a look at the web-site I mentioned above....
0
 
LVL 96

Expert Comment

by:Lee W, MVP
ID: 16940475
I'm very familiar with pkzip 2.04g.  It is NOT free - it IS shareware - click on the manual - at the top it CLEARLY states it is shareware.  In addition, it's 16 bit (no consumer OS was 32 bit when PKZIP was released).
0
 
LVL 14

Expert Comment

by:cwwkie
ID: 16944528
> I'm very familiar with pkzip 2.04g.  It is NOT free - it IS shareware

I agree with that. I have even doubts if the link is completely legal.
It includes for example Turbo Pascal 5.5. But this is not freeware! It is free of charge, but still copyrighted. It is very clearly stated that "These files may not be made available via the Internet or any hard copy media" (see http://bdn.borland.com/article/20803)
0
 
LVL 6

Expert Comment

by:dotENG
ID: 16948965
0
 
LVL 14

Accepted Solution

by:
FriarTuk earned 100 total points
ID: 16951516
winrar u d:\test.rar -inul -os -ow -r -x*.rar c:\*.*

  u             update & add
filename
  inul         Disable all messages
  os          Save NTFS streams
  ow         Save or restore file owner and group
  r             Recurse subdirectories
  x<file>   Exclude specified file = *.rar
path = c:\*.*
0
 
LVL 4

Expert Comment

by:Stephen McTigue
ID: 16992465
You could try drvspace in your config.sys
Pkzip might also work.
You could also cut the space it takes up in half by making it only backup every other day.
0
 
LVL 14

Expert Comment

by:FriarTuk
ID: 16998394
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

732 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