做一个WebService就可以了,在执行某个事件的时候去请求这个服务

解决方案 »

  1.   

    using System.IO
    string path = @"c:\temp\MyTest.txt";
    File.Delete(path);
      

  2.   

    FileInfo file=new FileInfo(Server.MapPath(fileUrl));
    file.Delete();
      

  3.   

    希望对你有所帮助 private void RemoveFiles(string strPath)

    try
    {
    System.IO.DirectoryInfo di = new DirectoryInfo(strPath);
    FileInfo[] fiArr = di.GetFiles();
    foreach (FileInfo fi in fiArr)

    if(fi.Extension.ToString() ==".gif" )
    {
    // if file is older than 2 minutes, we'll clean it up
    TimeSpan min = new TimeSpan(0,0,0,2,0);
    if(fi.CreationTime < DateTime.Now.Subtract(min))
    {
    fi.Delete();
    }
    }
    }
    }
    catch
    {}
    }
      

  4.   

    希望对你有所帮助:
    private void RemoveFiles(string strPath)

    try
    {
    System.IO.DirectoryInfo di = new DirectoryInfo(strPath);
    FileInfo[] fiArr = di.GetFiles();
    foreach (FileInfo fi in fiArr)

    if(fi.Extension.ToString() ==".gif" )
    {
    // if file is older than 2 minutes, we'll clean it up
    TimeSpan min = new TimeSpan(0,0,0,2,0);
    if(fi.CreationTime < DateTime.Now.Subtract(min))
    {
    fi.Delete();
    }
    }
    }
    }
    catch
    {}
    }