vs2008如何操作win.rar压缩包中的文件夹?
教学.rar——课程——数学、英语、物理——……是这样,比如说我有一个叫教学.rar的压缩包,它的里面有一个叫“课程”的根文件夹,在它下面分别是每门课的文件夹,在每门课的文件夹里存放着该课程的内容,我现在想通过asp.net获取这个压缩包中根文件夹的名称,也就是说我该如何获取“课程”这个名字?请各位帮帮忙,先谢谢大家了 --------------------编程问答-------------------- 据我所知,可以先用ICSharpCode.SharpZipLib解压,再用dictionary类来操作目录。 --------------------编程问答-------------------- 解压到临时目录,再取文件夹名称。 --------------------编程问答-------------------- 直接获取 不可能吧
肯定要先解压~~
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = false;
//string temp = null;
string[] strOutput = new string[2];
p.Start();
p.StandardInput.WriteLine("C:");
p.StandardInput.WriteLine("cd Program files");
p.StandardInput.WriteLine("cd winrar");//你可以先查一下winrar.exe所在的目录,然后启动之
p.StandardInput.WriteLine(@"winrar E f:\CSHight.rar f:\");//将f:\CSHight.rar 解压到F根目录
//strOutput[0]=p.StandardOutput.ReadLine();
在获取文件名
string aFirstName = aFile.Substring(aFile.LastIndexOf("\\") + 1, (aFile.LastIndexOf(".") - aFile.LastIndexOf("\\") - 1)); --------------------编程问答-------------------- 先解压再处理
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.FileName = "cmd.exe";
p.Close();
string pa="";
System.Diagnostics.Process Process1=new Process();
Process1.StartInfo.FileName=""+"//Rar.exe";
Process1.StartInfo.Arguments=" x -inul -y "+pa+" "+mPath+"";
Process1.Start();
while(!Process1.HasExited)
{ }
File.Delete(pa); --------------------编程问答-------------------- 有没有不解压就能获取的办法?比如用win.rar自带的那些参数“a c d e f……”什么的,对了它有一个开关参数"-ep1"为什么不起作用,有哪位大侠知道吗? --------------------编程问答-------------------- 先谢谢以上各位 --------------------编程问答-------------------- 哪位高手能再给出点主意吧? --------------------编程问答--------------------
被他们写了 就是先要用解压软件将rar解压 然后得到目录
补充:.NET技术 , ASP.NET