Atitit 遍历文件夹算法 autoit attilax总结 _FileListToArray

Atitit 遍历文件夹算法 autoit attilax总结

Lists files andor folders in a specified folder (Similar to using Dir with the /B Switch)

#include <File.au3>
_FileListToArray ( $sFilePath [, $sFilter = "*" [, $iFlag = $FLTA_FILESFOLDERS [, $bReturnPath = False]]] )

Parameters

$sFilePath

Folder to generate filelist for.

$sFilter

[optional] the filter to use, default is *. (* and ? wildcards accepted - See Remarks)

$iFlag

[optional] specifies whether to return files folders or both
    $FLTA_FILESFOLDERS (0) = (Default) Return both files and folders
    $FLTA_FILES (1) = Return files only
    $FLTA_FOLDERS (2) = Return Folders only
    Constants are defined in FileConstants.au3

$bReturnPath

[optional] If True the full path is appended to the filefolder path, otherwise it is relative to the $sFilePath folder. Default is False.

Return Value

Success:

A one-dimensional array.
    $aArray[0] = Number of FilesFolders returned
    $aArray[1] = 1st FileFolder
    $aArray[2] = 2nd FileFolder
    $aArray[3] = 3rd FileFolder
    $aArray[n] = nth FileFolder

Failure:

sets the @error flag to non-zero.

@error:

1 - Folder not found or invalid
2 - Invalid $sFilter
3 - Invalid $iFlag
4 - No File(s) Found

#include <Array.au3>

#Include <File.au3>

$path="C:UsersAdministrator.ATTILAXPC188Documents 2d"

$filelist = _FileListToArray ($path)

ConsoleWrite("-----ret")

ConsoleWrite(UBound( $filelist))

   For $i=0 To UBound( $filelist)-1

         ConsoleWrite($filelist[$i]&@CR&@LF)

next

ConsoleWrite (" ex:"&@error)

ConsoleWrite("-----end")

Func aa()

EndFunc

Ahk

;filelist

#Persistent

; C:dAutoHotKeyAutoHotkey.exe C: workspaceatiplat_eeJSsystrayfilelist.ahk

; $path="C:UsersAdministrator.ATTILAXPC188Documents 2d"

Loop,C:UsersAdministrator.ATTILAXPC188Documents 2d*.*,,1

{

;msgbox,%A_LoopFileName%

msgbox,%A_LoopFileFullPath%    ;full path of file

;%A_LoopFileName%

}

作者:: 绰号:老哇的爪子claw of Eagle 偶像破坏者Iconoclast image-smasher

捕鸟王"Bird Catcher  kok  虔诚者Pious 宗教信仰* Defender Of the Faith. 卡拉卡拉红斗篷 Caracalla red cloak 万兽之王

简称:: Emir Attilax Akbar 埃米尔 阿提拉克斯 阿克巴

全名::Emir Attilax Akbar bin Mahmud bin  attila bin Solomon bin adam Al Rapanui 埃米尔 阿提拉克斯 阿克巴 本 马哈茂德 本 阿提拉 本 所罗门 本亚当  阿尔 拉帕努伊

常用名:艾提拉(艾龙),  EMAIL:1466519819@qq.com

头衔:uke总部o2o负责人,全球网格化项目创始人,

uke交友协会会长  uke捕猎协会会长 Emir Uke部落首席大酋长,

uke宗教与文化融合事务部部长, uke宗教改革委员会副主席

uke制度与重大会议委员会委员长,uke保安部首席大队长,uke制度检查委员会副会长,

uke 首席cto   软件部门总监 技术部副总监  研发部门总监主管  产品部副经理 项目部副经理   uke科技研究院院长 uke软件培训大师

uke波利尼西亚区大区连锁负责人 汤加王国区域负责人 uke克尔格伦群岛区连锁负责人,莱恩群岛区连锁负责人,uke布维岛和南乔治亚和南桑威奇群岛大区连锁负责人

 Uke软件标准化协会理事长理事长 Uke 数据库与存储标准化协会副会长

uke终身教育学校副校长   Uke医院 与医学院方面的创始人

 uec学院校长, uecip图像处理机器视觉专业系主任   uke文档检索专业系主任

Uke图像处理与机器视觉学院首席院长

Uke 户外运动协会理事长  度假村首席大村长   uke出版社编辑总编

转载请注明来源:attilax的专栏  ?http://blog.s.net/attilax

--Atiend  v8