Solved

Windows 2008 R2 unzip command

Posted on 2013-01-23
9
6,082 Views
Last Modified: 2013-01-29
I noticed that when a zip file is read using Win 2008 Explorer,
the Explorer is able to extract out the files from the zip.

In 7-zip, I can issue  '7z -l zipfile' to view contents of a zip file
& as a way to verify the zip file's integrity is intact.

Without 7-zip, winzip or any 3rd party, what's the equivalent
Windows 2008 command to view the contents of a zip file
(without getting into Explorer).

Reason I need this is I'm writing a Windows batch script to
check integrity of a zip file that is ftp'ed (get) over from a
remote ftp server.

In 7-Zip, I'll issue "7z -l zipfile" & then test the errorlevel ie
7z -l zipfile
if %errorlevel% NEQ 0 echo zipfile is bad
if %errorlevel% EQ 0 echo zipfile is good
0
Comment
Question by:sunhux
9 Comments
 
LVL 9

Assisted Solution

by:TunerML
TunerML earned 100 total points
ID: 38809745
The 'compress' utility found on the W2k3 resource kit provides only basic functionality, for that end you could use it on the W2k8 server. I do not believe that it was even included in the W2k8 resource kit and therefore without a third party option you may be unable to complete this. Most admins I know use 7-zip as a full functional command line zip utility. 'Compress' is a very limited utility and most likely will not have a command line option to do integrity testing. Another expert may be able to shed more light but I am quite confident in my response.
0
 

Author Comment

by:sunhux
ID: 38809753
Just to add a bit:
my client disallows freeware/opensource tools (eg: 7zip)
to be installed on their Win2008 servers & they're not
prepared to pay for Commercial zipping tools so we
have to use Windows native zip/unzip.  The remote end's
management paid for Commercial zipping tool.

Can't use expand or compress commands as these commands
don't 'zip' up all files into one single zip file (as far as I understand)
0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 300 total points
ID: 38809849
0
 
LVL 16

Assisted Solution

by:AlexPace
AlexPace earned 100 total points
ID: 38809921
Here is an idea that is outside the box: Some FTP servers support integrity checking with CRC, MD5, SHA1 etc... You could use this feature to validate the accuracy of the file transfer so at least you'll know that if the zip file is somehow invalid then the source file on the remote server is also invalid in the exact same way.  

Another idea is to use a scriptable FTP client with error handling that includes zip capability in the scripting.  This way you could just attempt to unzip it and trap any error.  If no error you know it works.  

Another idea... have them PGP encrypt the zip file.  Attempt to decrypt the file.  If the transfer was not perfect the decryption will fail.
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:sunhux
ID: 38810015
AlexPace, the customer disallows any 3rd party/Opensource ftp
client & ftp server;  only MS ftp server & MS ftp client is allowed:
does MS ftp'ies have these features?

To re-emphasize, no 7-zip, freezip or freeware zips allowed while
they're not going to pay for commercial zip tools even if it costs
only US$10 for a commercial tool (unbelievable demand but that's
what my customer's policy is).

Arnold, what you gave in that url looks like a Powershell script,
not a VB.  I can use PS but what's the syntax to use that script
& what's the equivalent of '7z.exe -l zipfile' ?  Pls give examples.

I'm Powershell illiterate
0
 

Author Comment

by:sunhux
ID: 38810026
> what's the syntax to use that script & what's the equivalent of
> '7z.exe -l zipfile' ?  Pls give examples

Also, after executing that PS script, can I check its status by
' if %errorlevel% NEQ 0 ...... " ?

Also, give me a sample command of that PS script to unzip
a zipfile
0
 
LVL 76

Assisted Solution

by:arnold
arnold earned 300 total points
ID: 38810187
I provided an example of a reference powershell script that you can test to see what information you can glean from it.
The reference to VB was a suggestion to explore whether a similar capacity/capability exist in vb the problem is that several links I ve thought of including refer to loading referencing resources outside the built into the MS OS.
http://stackoverflow.com/questions/30211/can-windows-built-in-zip-compression-be-scripted
IMHO, exploring a functionality of a script in a language I am not familiar helps to understand the I.e. you know the input and what you want to explore along withthe source data.
I am not in a position to dissect the powershell code to address directly your followup question.
0
 

Author Comment

by:sunhux
ID: 38818165
Just one last question:

my customer asks:  since it's possible to unzip
from Windows Explorer (in Win 2008 R2), isn't
there any equivalent command (at command
line) to do zip & unzip in Win 2008 ?  If there
is, what's those commands?
0
 
LVL 76

Accepted Solution

by:
arnold earned 300 total points
ID: 38818743
Windows is primarily a graphical setup and many of its features are built into the graphical response.  The mechanism to open/extract the data is built-into explorer without an equivalent command line executable.  Using vbscript, powershell cmdlets is likely how you can get to do some, but the scope of the information you want/need might not be available without using alternate tools.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
In our personal lives, we have well-designed consumer apps to delight us and make even the most complex transactions simple. Many enterprise applications, however, are a bit behind the times. For an enterprise app to be successful in today's tech wo…
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
Viewers will learn how to use the Hootsuite Dashboard.

747 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

13 Experts available now in Live!

Get 1:1 Help Now