
January 16th, 2007, 12:17 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Posts: 15
Time spent in forums: 1 h 3 m
Reputation Power: 0
|
|
|
Opening zip files using Shell.Application
Hey, all. I'm trying to 1) read the contents of a zip file, then to 2) unzip it into a folder that I specify. We'll get to the unzipping later. Here's the code to read the list of items in a zip file:
Code:
zipfile = "D:\www\stuffhere\html\textzip.zip"
'unzipdir = "D:\www\stuffhere\html\unzipped"
Set objShell = CreateObject("Shell.Application")
Set SrcFldr=objShell.NameSpace(zipfile)
Set DestFldr=objShell.NameSpace(unzipdir)
if srcfldr is nothing then
response.write "Zip file not found"
else
if DestFldr is nothing then
response.write "Unzip Directory file not found"
else
Set FldrItems=SrcFldr.Items
For Each objItem in FldrItems
response.write objItem.Name & "<br>"
Next
end if
end if
In my Win XP Pro testing environment, I am able to read and list each file within the zip file. Here's my problem: In Windows 2k server, I cannot read the contents of the zip file. I've read somewhere that XP treats .zip files as folders, so it may not apply to 2k server.
In Windows 2k3 Server, however, I get an unspecifed error once I try to invoke
Code:
Set SrcFldr=objShell.NameSpace(zipfile)
The only thing I get is an error Number=(0x80070002)
Any ideas on either?
|