ASP decompression (Online decompression Class) _ Application techniques

Source: Internet
Author: User
Tags rar
Copy Code code as follows:

<%
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
' \ 1. C:\windows\system32\cmd.exe
' \ \ Copy the path where this file is located
'\\
' \ 2. Put C:\program\winrar\rar.exe
' \ \ Copy the path where this file is located and rename it to WinRAR.exe
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
' \ Compresspath (ByVal s)
' \ Zip file path | String variants
'\\
' \ Decompresspath (ByVal s)
' \ \ Uncompressed folder for files | String variants
'\\
' \ Compress
' \ \ Online compression
'\\
' \ Decompress
' \ \ Online Decompression
'\\
' \ Power by Never-online
'\\
' \ email:bluedestiny[at]126.com
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

OPTION EXPLICIT

Class Compress_decompress_files

Private version, copyright
Private oWshShell, oFSO
Private Scompresspath, Sdecompresspath

Private Sub Class_Initialize
version= "Compress_decompress_files BUILDER 20051015"
Copyright= "Power by MIRACLE (Bluedestiny)"
Set Ofso=server. CreateObject ("Scripting.") FileSystemObject ")
Set Owshshell=server. CreateObject ("Wscript.Shell")
Writeln (version+ "<br>" +copyright)
End Sub
Private Sub Class_Terminate
If IsObject (oWshShell) Then set owshshell=nothing
If IsObject (OFSO) Then set ofso=nothing
End Sub
Private Function PhysicalPath (ByVal s)
Physicalpath=server.mappath (s)
End Function
Private Sub Validatefile (ByVal s)
If Ofso.fileexists (s) then Exit Sub
If Ofso.folderexists (s) then Exit Sub
Callerr "file (folder) not exists!"
End Sub
Private Sub CreateFolder (ByVal s)
If Ofso.folderexists (s) then exit Sub
Ofso.createfolder (s)
End Sub
Private Sub Writeln (ByVal s)
Response.Write "<p>" + S + "</p>" + VbCrlf
End Sub
Private Sub Callerr (ByVal s)
Writeln "<p><b>ERROR:</b></p>" + S
Response. End
End Sub
Private Sub Callsucc (ByVal s)
Writeln "<p><b>SUCCESS:</b></p>" + S
End Sub

Public Sub Compress
Validatefile (Scompresspath)
Owshshell.run ("WinRAR A" + Scompresspath + "" + Sdecompresspath & "")
If Err.number>0 then Callerr ("Compress lost!")
CALLSUCC ("Compress <b>" + Sdecompresspath + "</b> to <b>" + Scompresspath + ".rar</b> successfully !")
End Sub
Public Sub Decompress
Validatefile (Scompresspath)
CreateFolder (Sdecompresspath)
Owshshell.run ("WinRAR X" + Scompresspath + "" + Sdecompresspath & ")
If Err.number>0 then Callerr ("Decompress lost!")
CALLSUCC ("Decompress <b>" + Scompresspath + ".rar</b> to <b>" + Sdecompresspath + "</b> successful ly! ")
End Sub

Public Property Let Compresspath (ByVal s)
Scompresspath=physicalpath (s)
End Property
Public Property Let Decompresspath (ByVal s)
Sdecompresspath=physicalpath (s)
End Property

End Class
%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<TITLE> ASP on-line decompression </TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
<style>
* {
font-size:10.2pt;
Font-family:tahoma;
}
</style>
</HEAD>

<BODY>
<%
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
' \ \ has compressed file Compress.rar
' \ Required compressed file Decompressfolder folder
'\\
' \ \ Compress.rar unzip to 1 folder
' \ \ Compress the Decompressfolder folder to 2.rar
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

Dim oexample

Set Oexample=new compress_decompress_files
Oexample.compresspath= "Decompressfolder"
Oexample.decompresspath= "1"
Oexample.compress

Oexample.compresspath= "Compress"
Oexample.decompresspath= "2"
Oexample.decompress

Set oexample=nothing
%>
</BODY>
</HTML>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.