Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to integrate FSO with my asp code, how? 1

Status
Not open for further replies.

Ken011

MIS
Oct 13, 2006
66
US
Hello again experts:
I use the following code to unzip zipped files from one folder to another.

It works well except that I can only unzip one file at a time.

This is the code:
Code:
<% 
Dim objZip 
Set objZip = Server.CreateObject("XStandard.Zip") 
objZip.UnPack "C:\myZippedFiles\rssfeed.zip", "C:\myUnzippedFile\" 
Set objZip = Nothing 
%>

To work around this problem,I need to use the Scripting.FileSystemObject to loop through all the zip files in the folder.

Below is the FSO code:
Code:
<% 
Set FSO = Server.CreateObject("Scripting.FileSystemObject") 
Set fldr = FSO.GetFolder( Server.MapPath("/relative/path") ) 

For Each fil In fldr.Files 
    If LCase( Right( fil.Name, 4 ) ) = ".zip" Then 
        zipFilePath = fil.Path 
        ... unzip ... 
    End If 
Next 
%>

But I need to integrate this fso code with the unzip code.

Can someone please, please help?

Thanks in advance
 
[tt]<%
Dim objZip,FSO,fldr,fil
Set objZip = Server.CreateObject("XStandard.Zip")
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set fldr = FSO.GetFolder( Server.MapPath("/relative/path") )

For Each fil In fldr.Files
If LCase( Right( fil.Name, 4 ) ) = ".zip" Then
[red]'[/red]zipFilePath = fil.Path
objZip.UnPack fil.path, "C:\myUnzippedFile\"
End If
Next
Set fldr = Nothing
Set FSO = Nothing
Set objZip = Nothing
%>[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top