• 大小: 0.33M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-14
  • 语言: C#
  • 标签: 文件  删除  目录  

资源简介

通过配置路径,和过期时间,去删除指定目录下的过时文件

资源截图

代码片段和文件信息

using Grassinfo.PortPlatfrom.Common;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DeleteOverdueFile
{
    class Program
    {
        static List FileList = new List();
        static void Main(string[] args)
        {
            try
            {
                var path = AppDomain.CurrentDomain.baseDirectory + @“Config\log4net.config“;
                log4net.Config.xmlConfigurator.Configure(new FileInfo(path));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            try
            {
                Log4NetHelper.Info(“DeleteOverdueFile Starting “);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-03-10 10:52  DeleteOverdueFile\
     目录           0  2017-03-22 14:23  DeleteOverdueFile\DeleteOverdueFile\
     文件         261  2017-03-22 14:23  DeleteOverdueFile\DeleteOverdueFile\App.config
     目录           0  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\Config\
     文件        1800  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\Config\log4net.config
     文件        4488  2017-03-10 10:57  DeleteOverdueFile\DeleteOverdueFile\DeleteOverdueFile.csproj
     文件         453  2017-03-10 10:57  DeleteOverdueFile\DeleteOverdueFile\DeleteOverdueFile.csproj.user
     文件        2954  2017-03-10 10:56  DeleteOverdueFile\DeleteOverdueFile\Program.cs
     目录           0  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\Properties\
     文件        1358  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\Properties\AssemblyInfo.cs
     目录           0  2017-03-10 10:58  DeleteOverdueFile\DeleteOverdueFile\bin\
     目录           0  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\Debug\
     文件         187  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\Debug\DeleteOverdueFile.exe.config
     文件       24224  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\Debug\DeleteOverdueFile.vshost.exe
     文件         187  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\Debug\DeleteOverdueFile.vshost.exe.config
     文件         490  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\Debug\DeleteOverdueFile.vshost.exe.manifest
     目录           0  2017-03-10 10:58  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\
     文件        6656  2017-03-10 10:57  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\DeleteOverdueFile.exe
     文件         433  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\DeleteOverdueFile.exe.config
     文件       17920  2017-03-10 10:57  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\DeleteOverdueFile.pdb
     文件       23168  2017-03-10 10:58  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\DeleteOverdueFile.vshost.exe
     文件         433  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\DeleteOverdueFile.vshost.exe.config
     文件         490  2013-03-18 17:00  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\DeleteOverdueFile.vshost.exe.manifest
     文件       46080  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\Grassinfo.PortPlatfrom.Common.dll
     文件      301056  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\DeleteOverdueFile\log4net.dll
     目录           0  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\Release\
     文件        6656  2017-03-10 10:57  DeleteOverdueFile\DeleteOverdueFile\bin\Release\DeleteOverdueFile.exe
     文件         433  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\Release\DeleteOverdueFile.exe.config
     文件       17920  2017-03-10 10:57  DeleteOverdueFile\DeleteOverdueFile\bin\Release\DeleteOverdueFile.pdb
     文件       23168  2017-03-22 13:41  DeleteOverdueFile\DeleteOverdueFile\bin\Release\DeleteOverdueFile.vshost.exe
     文件         433  2017-03-10 10:52  DeleteOverdueFile\DeleteOverdueFile\bin\Release\DeleteOverdueFile.vshost.exe.config
............此处省略23个文件信息

评论

共有 条评论