ASP decompression (online decompression class)

Source: Internet
Author: User

Copy codeThe Code is as follows: <%
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
'\\
'\ 1. c: \ windows \ system32 \ cmd.exe
'\ Copy the path of the object
'\\
'\ 2. Set c: \ program \ winrar \ rar.exe
'\ Copy and rename the path of this file to winrar.exe
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\\\\\\\
'\\
'\ CompressPath (byVal s)
'\ Path of the compressed file | string Variation
'\\
'\ DecompressPath (byVal s)
'\ Folder of the decompressed file | string Variation
'\\
'\ Compress
'\ Online Compression
'\\
'\ Decompress
'\ Decompress online
'\\
'\ 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> successfully! ")
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 online 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 a compressed file compress.rar
'\ The decompressFolder folder to be compressed
'\\
'\ Decompress compress.rar to the 1 folder
'\ Compresses 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>

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.