Solved

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

Posted on 2011-03-08
5
811 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 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

14 Experts available now in Live!

Get 1:1 Help Now