?
Solved

File compression using WINRAR command line utility on Windows Server 2003 machine

Posted on 2011-03-08
5
Medium Priority
?
853 Views
Last Modified: 2013-12-01
I have to write a batch file to use WinRAR cmd line utility which creates an archive in .zip format, which can be opened by any machine without WinRAR. I also need to copy the list of files archived to a .txt file, which will act as a log file for me to see whether the operation was successful or not. I was able to create a .rar file using rar.exe and was able to redirect the output to a .txt file using

"C:\Program Files\WinRAR\rar.exe" a -m5 -ed "c:\Supreeth\resources.rar" "C:\Projects\MyProject\resources" >"c:\Supreeth\log.txt"

However, the resources.rar requires only WinRAR to extract. All the files archived were added in log.txt.
I used
"C:\Program Files\WinRAR\winrar.exe" a -afzip -m5 -ed "c:\Supreeth\resources.zip" "C:\Proje
cts\MyProject\resources" >"C:\Supreeth\log.txt"
The resources.zip file created can be opened by a machine which doesn't have winrar. But, I was not able to log all the files archived.

I want to create a .zip file and log the files archived as well. Please help

0
Comment
Question by:supreeths84
[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
  • 2
5 Comments
 
LVL 3

Expert Comment

by:VespaMaru
ID: 35075034
I haven't used win-rar lately, but 7Zip can do what you want.  It is a Free open source archiver that supports Zip, Rar and many other formats.


C:\Program Files\7-Zip>7z a -tzip -mx5 c:\Supreeth\resources.zip C:\Proje
cts\MyProject\resource > C:\Supreeth\log.txt

This command should work.
7Zip can be found at:
http://sourceforge.net/projects/sevenzip/
0
 

Author Comment

by:supreeths84
ID: 35075078
I was using 7-zip all these days. But the file size grew beyond 6 GB and 7-zip is giving me an error saying "Can't allocate enough memory". So, I was looking for other compression utils and WinRAR was able to compress my file which was more than 6 GB. Can you please help me with this?
0
 
LVL 3

Accepted Solution

by:
VespaMaru earned 2000 total points
ID: 35075454
This may be a weird hack, I downloaded WinRAR to test it out, but I can not seem to find a way to get WinRAR to list files or play nice with archives that are not RAR format.  Perhaps you can compress with WinRAR then test the archive with 7Zip.

Example:
start /w "C:\Program Files\WinRAR\winrar.exe" a -afzip -v -m5 -ed c:\Supreeth\resources.zip C:\Projects\MyProject\resource && "C:\Program Files\7-Zip\7z.exe" t  c:\Supreeth\resources.zip > C:\Supreeth\log.txt

Since the archive will already exist, you should be able to avoid the memory allocation issues. You can add " -ilogc:\Supreeth\ErrorLog.txt " if you are worried that WinRAR may encounter an error.
0
 
LVL 27

Expert Comment

by:Tolomir
ID: 35381948
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

770 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