zoukankan      html  css  js  c++  java
  • ScanFiles脚本

    Function ScanFolder(TF,WORD)
       Dim Fso,TFCount
       TFCount=0
       Set Fso = CreateObject("Scripting.FileSystemObject")
       Set FDS = Fso.GetFolder(TF)
       For Each FD in FDS.subFolders
     Call ScanFolder(FD,WORD)
           For Each F in FSO.GetFolder(FD).Files
     IF CheckFileExt(F.Path)=True then
      IF ScanWord(F.Path,WORD)=True Then Wscript.Echo F.Path
     End IF
     Next
       Next
    End Function

    Function ScanWord(pFile,WORD)
     IF Instr(ReadText(pFile),WORD) Then ScanWord=True:Exit Function
     ScanWord=False  
    End Function

    Function ReadText(pFile)
       Dim FSO,F
       Set FSO = CreateObject("Scripting.FileSystemObject")
       Set F = FSO.OpenTextFile(pFile,1,True)
       ReadText=F.ReadAll
    End Function

    Function CheckFileExt(Fname)
       Dim FileExtStr,FileExt
       FileExtStr=Right(Fname,Len(Fname)-InstrRev(Fname,".",-1,1)+1)
     CheckFileExt=False
       FileExt=".c|c.h"
       FileExt=Split(FileExt,"|")
       For I=0 to Ubound(FileExt)
     IF Instr(Fname,FileExt(I)) Then CheckFileExt=True:Exit Function
       Next
    End Function
    '====================Start===============================
    IF Wscript.Arguments.Count<2 Then
    Wscript.Echo "┌┄┄┄┄┄┐┌┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┐"&vbCrlf
    Wscript.Echo "┆参数不对!┆┆ScanFolder.Vbs By Liou QQ:5172388 http://cnLiou.cn┆"&vbCrlf
    Wscript.Echo "└┄┄┄┄┄┘└┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┘"&vbCrlf
    Wscript.Quit
    End IF
    ScanFolder Wscript.Arguments(0),WScript.Arguments(1)

  • 相关阅读:
    MySQL语法
    Linux常用命令大全
    触发器使用UTL_SMTP包发送邮件
    MySQL——触发器的创建和使用总结
    MySQL数据库备份
    Nginx配置文件(nginx.conf)配置详解
    JS弹出框,打开文件,保存文件,另存为。。。。
    java excel两种操作方式
    Zookeeper的优缺点
    activemq linux安装
  • 原文地址:https://www.cnblogs.com/cnLiou/p/200548.html
Copyright © 2011-2022 走看看