zoukankan      html  css  js  c++  java
  • 自动删除iis日志的js脚本

    把保存成deliislog.js然后拖到计划任务里就行了,默认是删除3天前的。

    function dellogfile(beforedays) {
         var fso = new ActiveXObject("Scripting.FileSystemObject");
         var dir = fso.GetFolder("C:\\WINDOWS\\system32\\LogFiles");     //改成你的 IIS 日志目录
         for (var fc = new Enumerator(dir.SubFolders); !fc.atEnd(); fc.moveNext()) {
             if (fc.item().name.substr(0,5) == "W3SVC") {
                 for (var logfiles = new Enumerator(fc.item().Files); !logfiles.atEnd(); logfiles.moveNext()) {
                     var fileName = logfiles.item().name;
                     var year = "20" + fileName.substr(2, 2);
                     var mouth = fileName.substr(4, 2);
                     var day = fileName.substr(6, 2);
                     var days = Math.round(((new Date()).getTime() - Date.UTC(year, mouth - 1, day)) / 1000 / 60 / 60 / 24);
                     if (days >= beforedays) logfiles.item().Delete();
                 }
             }
         }
    }

    dellogfile(3);

  • 相关阅读:
    vpp l3 bvi
    set interface ip address: failed to add 1 on loop1 which conflicts with
    Failed: no source address for egress interface
    vpp vrf
    vpp bvi
    creates 2 connected namespaces vpp1 & vpp2
    unknown input `arp'
    vpp cmd
    vxlan bum
    Go流程结构(if)
  • 原文地址:https://www.cnblogs.com/daxia/p/950861.html
Copyright © 2011-2022 走看看