博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
asp在线压缩和解压缩文件(文件夹)
阅读量:6502 次
发布时间:2019-06-24

本文共 3412 字,大约阅读时间需要 11 分钟。

<%
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\ 1. c:\windows\system32\cmd.exe
'\\ 拷贝把本文件所在的路径
'\\
'\\ 2. 把 c:\program\winrar\rar.exe
'\\ 拷贝把本文件所在的路径 并改名为WinRAR.exe
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\ compressPath(byVal s)
'\\ 压缩文件的路径 | 字符串变体
'\\
'\\ decompressPath(byVal s)
'\\ 解压缩文件的文件夹 | 字符串变体
'\\
'\\ compress
'\\ 在线压缩 | sub
'\\
'\\ decompress
'\\ 在线解压缩 | sub
'\\
'\\ POWER BY MIRACLE (BLUEDESTINY)
'\\
'\\ 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> New Document </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>
<%
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\ 设有压缩文件 compress.rar
'\\ 需压缩文件 decompressFolder 文件夹
'\\
'\\ 将 compress.rar 解压缩至 1 文件夹
'\\ 将 decompressFolder 文件夹 压缩至 2.rar
'\\
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
dim oExample
set oExample=new COMPRESS_DECOMPRESS_FILES
oExample.compressPath="decompressFolder"
oExample.decompresspath="1"
oExample.compress
oExample.compressPath="compress.rar"
oExample.decompresspath="2"
oExample.decompress
set oExample=nothing
%>
</BODY>
</HTML>
posted on
2014-03-20 09:05 阅读(
...) 评论(
...)

转载于:https://www.cnblogs.com/fs3000/p/3612871.html

你可能感兴趣的文章
service
查看>>
shell与if相关参数
查看>>
用fail2ban阻止ssh暴力破解root密码
查看>>
Mysql Order By 字符串排序,mysql 字符串order by
查看>>
Python cos() 函数
查看>>
system.web下的HttpModules节点和system.webServer下的modules节点的配置区别
查看>>
Database Setup
查看>>
为Docker配置阿里加速器,系统为Debian8
查看>>
已知两条线段端点,判断是否相交及交点
查看>>
mac终端下svn常用命令
查看>>
电话号码校验
查看>>
任何股市都受这三个因素
查看>>
[树莓派(raspberry pi)] 01、在linux环境下给树莓派安装系统及入门各种资料
查看>>
HTML基础第十一讲---背景标志
查看>>
阻塞赋值与非阻塞赋值(verilog篇)
查看>>
nginx+tomcat单个域名及多个域名配置
查看>>
oracle数据库内存调整之增加内存
查看>>
4xx错误的本质:服务器已经接收到请求
查看>>
Sagit.Framework For IOS 开发框架入门开发教程2:一行代码实现引导页
查看>>
理解Kubernetes(1):手工搭建Kubernetes测试环境
查看>>