2 u014622314 u014622314 于 2014.10.28 08:38 提问

压缩问题,求大神帮下解决下
c#
    {


        string[] filenames = Directory.GetFiles(source);

        //DirectoryInfo file = new DirectoryInfo(path);
        //foreach (FileInfo f in Directory.GetFiles)
        foreach (string file in filenames)
        {

            if (Directory.Exists(file))
            {

                Compress(file, s);  //递归压缩子文件夹

            }

            else
            {

                using (FileStream fs = File.Open(file, FileMode.Open))
                {
                    byte[] buffer = new byte[4 * 1024];
                    ZipEntry entry = new ZipEntry(Path.GetFileName(file));

                    //直接取 C:\inetpub\logs\LogFiles\W3SVC3  里面日志文本
                    // ZipEntry entry = new                     ZipEntry(file.Replace(Path.GetPathRoot(file), ""));                      
                    entry.DateTime = DateTime.Now;
                    s.PutNextEntry(entry);
                    int sourceBytes;
                    do
                    {
                        sourceBytes = fs.Read(buffer, 0, buffer.Length);
                        s.Write(buffer, 0, sourceBytes);
                    } while (sourceBytes > 0);
                }
            }
        }
    }

我怎么把 var list = new DirectoryInfo(@"C:\inetpub\logs\LogFiles\W3SVC3\").GetFiles("*.log").Where(d => d.CreationTime.ToString("yyyyMMdd") == DateTime.Now.ToString("yyyyMMdd")).OrderBy(d => d.CreationTime); 条件加进去了

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!