Solved

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

Posted on 2011-03-08
5
825 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
  • 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 500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article we have discussed the manual scenarios to recover data from Windows 10 through some backup and recovery tools which are offered by it.
I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

679 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