快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

调用WINRAR压缩文件夹

服务器用WScript.Shell组件调用winrar中的rar.exe,在代码的同目录要上传cmd.exe和rar.exe

用法:rar.asp?path=要压缩的文件夹&rarname=压缩后的文件名&includefolder=包括子文件夹就不会空

<%
\\\'用法http://xx/rar.asp?path=要压缩的文件夹&rarname=压缩后的文件名&includefolder=包插子文件夹就不会空,
on error resume next
AppPath=server.mappath(".")&"" \\\'存放RAR.EXE和CMD.EXE的路径
zipfolder=server.mappath(request("path"))&"" \\\'要压缩的文件或文件夹
rarfile = request("rarname")
thispath = server.mappath(".")&""
if zipfolder<>"" and rarfile<>"" then
Set Shell = Server.CreateObject("WScript.Shell")
if err.number<>0 then
response.write "服务器不支持"
response.end
end if
if request("includefolder")<>"" then
cmd= thispath&"cmd.exe /c "&thispath&"rar.exe a -ep1 -r -t -o+ "&thispath&rarfile&" "& zipfolder &""
else
cmd= thispath&"cmd.exe /c "&thispath&"rar.exe a -ep1 -t -o+ "&thispath&rarfile&" "& zipfolder &""
end if
\\\'response.write cmd
RetCode = Shell.Run(cmd,1, True)
response.write "<a href=\\\'"&rarfile&"\\\'>"&rarfile&"</a>"
if err.number<>0 then
response.write "<a href=\\\'"&rarfile&"\\\'>"&rarfile&"</a>"
else
response.write err.description
end if
else
response.write "没有参数"
end if
%>
返回类别: 教程
上一教程: 截取固定长度字符串显示在页面
下一教程: 用ASP开发一个在线考试程序(九)

您可以阅读与"调用WINRAR压缩文件夹"相关的教程:
· 如何在服务器端调用WINZIP命令行对上传的多个文件打包压缩
· 服务器端调用WINZIP命令行对上传的多个文件打包压缩
· 在线解压缩上传的WINRAR文件
· 调用WINZIP命令行对上传的多个文件打包压缩
· 在线用表单建立文件夹
    微笑服务 优质保证 索取样品