asp在线压缩和解压缩文件(文件夹)
<%
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
'\\
'\\ 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

asp在线压缩和解压缩文件(文件夹)相关推荐

  1. compressing 压缩和解压缩文件和文件夹

    compressing 压缩和解压缩文件和文件夹 nodejs 中使用compressing处理对文件或文件夹的压缩和解压缩 支持四种压缩格式 tar gzip tgz zip 下面以zip为例,其他 ...

  2. asp.net在线压缩和解压缩的实现

    我们经常会遇到批量上传的问题,也会遇到将某个目录下所有文件都上传到服务器上的问题.那么,如何解决此类问题呢?以前的技术一般采用ActiveX等方式,这里我采用SharpZlib来实现,听说VS2005 ...

  3. java 解压与压缩代码_Java实现多文件压缩和解压缩代码详解

    Java实现多文件压缩和解压缩代码 import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStre ...

  4. java.util.zip_[Java 基础] 使用java.util.zip包压缩和解压缩文件

    Java API中的import java.util.zip.*;包下包含了Java对于压缩文件的所有相关操作. 我们可以使用该包中的方法,结合IO中的相关知识,进行文件的压缩和解压缩相关操作. Zi ...

  5. IOS开发之网络编程--文件压缩和解压缩

    2019独角兽企业重金招聘Python工程师标准>>> 前言: QQ表情包就用到了解压缩,从网络下载的那么多表情文件格式并不是一个一个图片文件,而是多个图片压缩而成的表情压缩包.下面 ...

  6. 利用WinRar压缩和解压缩文件

    今天的rar shell只是一个简单应用,rar.exe和winrar.exe语法都是一样的. 对rar而言,用rar.exe最好,不需要判断winrar在哪里,而且非常小,因为没有界面,所有压缩选项 ...

  7. python读压缩文件内容_使用Python读写及压缩和解压缩文件的示例

    读写文件 首先看一个例子: f = open('thefile.txt','w') #以写方式打开, try: f.write('wokao') finally: f.close() 文件的打开方式: ...

  8. C# 利用ICSharpCode.SharpZipLib.dll 实现压缩和解压缩文件

    我们 开发时经常会遇到需要压缩文件的需求,利用C#的开源组件ICSharpCode.SharpZipLib, 就可以很容易的实现压缩和解压缩功能. 压缩文件: /// <summary> ...

  9. Unity3D压缩和解压缩文件

    今天试了试,在Unity不能用C# IO类里的压缩和解压缩,看了论坛里的一些讨论,就想着能不能用第三方的压缩和解压缩动态库. 于是乎就下了一个Ionic.Zip.dll.然后,然后就没有然后了. Co ...

最新文章

  1. CentOs7安装tomcat
  2. curl_init()和curl_multi_init()多线程的速度比较
  3. 【Qt5.8】Qt5.8中QTableWidget 类介绍
  4. Hive和Hadoop及RDBMS关系
  5. java List 排序 Collections.sort() 对 List 排序
  6. docker 主进程 日志_运维笔记--docker高效查看后台日志
  7. shell 基本知识
  8. [Objective-C语言教程]数据封装(27)
  9. 为什么说担心 AI 抢人类饭碗纯粹是多余?
  10. 撕破币圈交易惊天骗局:超 30 亿美金成交量完全是虚假编造
  11. JavaScript知识点之“事件机制”
  12. Vue-watch侦听器和计算属性
  13. 字典树-大量字符串前缀及出现次数是否存在统计(Trie树-java)算法实现
  14. HTML制作简易个人简历(表单)
  15. 1024程序员节节日快乐
  16. 下周递交上市申请,腾讯持股的微医投资价值几何?
  17. php斗鱼弹幕接口,php实现斗鱼弹幕,一起来欣赏弹幕吧~
  18. github建立自己的个人网站
  19. 279. 自然数拆分
  20. 洛谷P2178 [NOI2015]品酒大会 后缀数组+单调栈

热门文章

  1. Spring Bean四种注入方式(Springboot环境)
  2. 关于进程间通信的学习心得
  3. RHEL5上配置VNCSERVER
  4. ASP.NET2.0 ReportingServices使用详解
  5. 磁盘文件目录罗列和list控件的使用
  6. Windows客户端C/C++编程规范“建议”——函数
  7. Python3中内置函数callable介绍
  8. OpenCV 2.2.0 CvvImage的使用
  9. 【Qt】QtCreator updatePchInfo:switching to none
  10. 【Live555】live555源码详解(一):BasicUsageEnvironment、UsageEnvironment