zoukankan      html  css  js  c++  java
  • C# 上传RAR文件 解压 获取解压后的文件名称

    此方法适用于C盘windows文件夹中有WinRAR.exe文件
    
    if (fileExt.ToUpper() == ".RAR")
                        {
                            string zpath = Server.MapPath("~/SendFileZIP/");
                            //不存在文件夹时创建文件夹
                            if (!Directory.Exists(zpath))
                            {
                                Directory.CreateDirectory(zpath);
                            }
                            //导入rar 压缩文件时,清空SendFileZIP文件夹里面所有的文件
                            DirectoryInfo clera = new DirectoryInfo(zpath);
                            deletefileOrDic(clera);
                            //解压 上传的rar文件 
                            int count = RARToFileEmail(zpath, filePath);
                            //判断解压是否成功 解压出来的文件数量是否大于
                            if (count > 0)
                            {
                                string[] strFiles = Directory.GetFiles(zpath);
                                string strfiel = "";
                                foreach (string item in strFiles)
                                {
                                    DirectoryInfo dirtory = new DirectoryInfo(item);
                                    //获取不是文件夹时
                                    if (!dirtory.Exists)
                                    {
                                        strfiel = strfiel + item.ToString();
                                        break;
                                    }
                                }
                                string zname = Path.GetFileName(strfiel).ToString();//获取 解压后的文件的名称
                                //解压后文件的名称
                                string zFilePath = zpath + zname;
                              
                            }
    
                        }
  • 相关阅读:
    CodeForces 404C Ivan and Powers of Two
    CodeForces 433C Ryouko's Memory Note-暴力
    if not
    python3的print函数
    交叉熵
    tensorflow一个很好的博客
    关于第几维的问题
    更新软件
    tensorflow训练代码
    tensorflow的一些函数
  • 原文地址:https://www.cnblogs.com/gc2013/p/3689046.html
Copyright © 2011-2022 走看看