只读文件夹中的日志文件

时间:2019-07-08 12:10:26

标签: if-statement foreach vbscript filesystems

我想从该文件夹中读取所有日志文件,但是当我尝试使用此代码时,会弹出一个错误消息,提示:

  

未定义子过程或功能过程。

在我添加If之前它起作用了,并且如果我将If的条件更改为1=1,它也起作用了。

Sub lst_files_Display
    Dim fullpath

    Dim sFolder
    sFolder = "D:\Berechtigungen"

    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Set Folder = oFSO.GetFolder(sFolder)

    For Each ooFile In Folder.Files
        If ooFile.Type Like ".log" Then 
            fullpath = ooFile.Path
            Set fopt = Document.CreateElement("OPTION")
            fopt.Text = fullpath
            fopt.Title = fullpath
            lst_files.Add fopt
        End If
    Next
End Sub

0 个答案:

没有答案
相关问题