找回密码
 加入
搜索
查看: 2347|回复: 2

[AU3基础] [已解决]如何抓資料夾底下*.log檔就好了

[复制链接]
发表于 2017-6-23 17:59:03 | 显示全部楼层 |阅读模式
本帖最后由 ipmitool 于 2017-6-26 07:57 编辑
#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>



Local $path = @ScriptDir

FindAllFile($path)





Func FindAllFile($sDir)

        Local $hSearch = FileFindFirstFile($sDir & "\*.*")

        ; 检查搜索是否成功

        If $hSearch = -1 Then Return

        While 1
                Local $sFile = FileFindNextFile($hSearch)

                If @error Then ExitLoop

                If @extended Then
                        FindAllFile($sDir & "" & $sFile)

                                                ;if $sFile=StringRight(".log",3) Then

                        ContinueLoop

                EndIf

                $open=FileOpen("1.txt",9)

                ;带目录
                FileWrite($open,$sDir & "" & $sFile & @crlf)

                ;文件名
                ;FileWrite($open,$sFile & @crlf)

                FileClose($open)

        WEnd

        ; 关闭搜索句柄

        FileClose($hSearch)



EndFunc
发表于 2017-6-25 18:19:04 | 显示全部楼层
if StringRight ( $sfile, 4 ) = ".log" then
 楼主| 发表于 2017-6-26 07:57:44 | 显示全部楼层
回复 2# yamakawa


    謝謝大大
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-25 05:06 , Processed in 0.074096 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表