vb.net压缩文件做成 vba压缩文件夹( 二 )


string destFileName = HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\" + "Backup_";
destFileName += DateTime.Now.ToString("yyyyMMddHHmmss");
destFileName += ".mbk";
//将数据库文件Copy到Backup目录,如果有重名文件就覆盖原文件
File.Copy(sourceFileName, destFileName, true);
//生成备份文件列表
ListBackupFiles();
Showmsg.Visible = true;
Showmsg.Text = "div align='center' style='margin-bottom:8px;'img src='https://www.04ip.com/post/images/aL.gif' style='margin-bottom:-6px;'/span class='alertTxt'备份数据库成功!/spanimg src='https://www.04ip.com/post/images/aR.gif' style='margin-bottom:-6px;'//div";
}
/// summary
/// 生成备份文件列表
/// /summary
/// returns文件列表,文件详细信息及操作选项的HTML代码/returns
public void ListBackupFiles()
{
//如果目录不存在则创建次目录
if (!Directory.Exists(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\"))
Directory.CreateDirectory(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\");
DirectoryInfo mydir = new DirectoryInfo(HttpContext.Current.Request.PhysicalApplicationPath + "Backup\\");
StringBuilder sb = new StringBuilder();
foreach (FileInfo f in mydir.GetFiles())
{
sb.Append("a href='https://www.04ip.com/post/backup/" + f.Name + "' target='_blank'img border='0' src='https://www.04ip.com/post/images/mdb.gif' style='margin:4px 3px -3px 0px'/" + f.Name + "/aa href='https://www.04ip.com/post/?cmd=DelFilesource=" + f.Name + "' title='删除备份文件'删除/a | a href='https://www.04ip.com/post/?cmd=Restoresource=" + f.Name + "' title='删除备份文件'还原数据库/a | " + f.Length/1024 + " KB | " + f.CreationTime + "br /");
}
lilBackupFileList.Text = sb.ToString();
}
}
把下面这句换成你的数据库地址:
//数据库路径
//lilDBPath.Text = HttpContext.Current.Request.PhysicalApplicationPath + "App_Data\\" + ConfigurationSettings.AppSettings["DBFile"];
VB.net 如何将TXT文件转换压缩成.gz文件手机敲很累的!一定要给分?。「袷绞牵簍ar 选项 文件.选项有 -c:产生打包文件 -v:显示详细信息 -f:指定压缩后的文件名 -z:打包同时压缩!举个例子吧!将目录my打包并压缩成my.tar.gz就这样tar -zcvf my.tar.gz my
vb.net进行文件压缩如果机器安装有winRar软件 , 就可以通过shell来借用他的功能达到压缩文件的效果;
参考代码如下:
Dim DeliveryF As String = Server.MapPath("..\Temp\DeliveryFactors.xls")'原始文件(压缩前)
Dim TruckInfo As String = Server.MapPath("..\Temp\TruckInformation.xls")
Dim QDetail As String = Server.MapPath("..\Temp\QuotationDetail.xls")
'用shell命令调用winrar.exe创建压缩文件()
Dim winRarexe As String = "C:\Program Files\WinRAR\Rar"'winzip执行文件的位置
Dim wtarget As String = "C:\temp\QuotationVAComparsion.zip"'目地文件(压缩后)
Dim command As String = winRarexe" a "wtarget" "DeliveryF" "TruckInfo" "QDetail
'这个命令你可以查看winrar的命令集
Dim retval As Double'Shell指令传回值
retval = Shell(command, AppWinStyle.MinimizedFocus)
【vb.net压缩文件做成 vba压缩文件夹】关于vb.net压缩文件做成和vba压缩文件夹的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读