FlyInSky Posted October 27, 2006 Share Posted October 27, 2006 (edited) This is my code.Why it's only get the first every subdirectory? Global $List[1]=[0] Func FileListToArray($Dir) Dim $FilePath,$FilesList,$Files,$i $FilesList=_FileListToArray($Dir) If (Not IsArray($FilesList)) and (@Error=1) Then MsgBox (0,"","No Files\Folders Found.") Return EndIf $Files=_FileListToArray($Dir,"*",1) If IsArray($Files) Then For $i=1 To $Files[0] $FilePath=$Dir&"\"&$Files[$i] ReDim $List[UBound($List)+1] $List[0]=$List[0]+1 $List[UBound($List)-1]=$FilePath Next EndIf $SubDir=_FileListToArray($Dir,"*",2) If IsArray($SubDir) Then For $i=1 To $SubDir[0] $FullPath=$Dir&"\"&$SubDir[$i] $tempList=FileListToArray($FullPath) For $i=1 To $tempList[0] ReDim $List[UBound($List)+1] $List[0]=$List[0]+1 $List[UBound($List)-1]=$tempList[$i] Next Next EndIf Return $List EndFunc Edited October 27, 2006 by FlyInSky Link to comment Share on other sites More sharing options...
GaryFrost Posted October 27, 2006 Share Posted October 27, 2006 This is Scripts and Scraps not Support SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
FlyInSky Posted October 27, 2006 Author Share Posted October 27, 2006 What is another way to do it? Link to comment Share on other sites More sharing options...
Valuater Posted October 27, 2006 Share Posted October 27, 2006 (edited) might want to take a look at this FileListToArray() by SmOke_Nhttp://www.autoitscript.com/forum/index.ph...st&p=2463768) Edited October 27, 2006 by Valuater Link to comment Share on other sites More sharing options...
FlyInSky Posted October 27, 2006 Author Share Posted October 27, 2006 (edited) might want to take a look at this FileListToArray() by SmOke_Nhttp://www.autoitscript.com/forum/index.ph...st&p=2463768)Thank you But it's not i need.I need a function of all subdirectoryies files. Edited October 27, 2006 by FlyInSky Link to comment Share on other sites More sharing options...
FlyInSky Posted October 27, 2006 Author Share Posted October 27, 2006 I have another script about it,it's work,why my script don't work? Func _filelist($searchdir) $search = FileFindFirstFile($searchdir & "\*.*") If $search = -1 Then return -1 While 1 $file = FileFindNextFile($search) If @error Then FileClose($search) return Elseif $file = "." or $file = ".." Then ContinueLoop ElseIf stringinstr(FileGetAttrib($searchdir & "\" & $file),"D") then _filelist($searchdir & "\" & $file) EndIf ConsoleWrite( $searchdir & "\" & $file & @crlf ) WEnd EndFunc Link to comment Share on other sites More sharing options...
dabus Posted October 27, 2006 Share Posted October 27, 2006 Try this one: http://www.autoitscript.com/forum/index.php?showtopic=5458Or even faster (at least for me): use dir and parse... oh, sorry, did you want to use FileListToArray by all means?!? Link to comment Share on other sites More sharing options...
FlyInSky Posted October 28, 2006 Author Share Posted October 28, 2006 Try this one: http://www.autoitscript.com/forum/index.php?showtopic=5458Or even faster (at least for me): use dir and parse... oh, sorry, did you want to use FileListToArray by all means?!?Yes.I want to get all files in the directory . Link to comment Share on other sites More sharing options...
suppa2 Posted January 3, 2007 Share Posted January 3, 2007 (edited) I'm very new to Autoit3. Well, I needed such a function, too,so I made one which works Func _getdirandsubdirs($dir) $c=1; $d=0; $temp=""; $folders=_FileListToArray($dir,"*.",2) While $c < UBound($folders, 1) $temp=_FileListToArray($musicfolder&$folders[$c],"*.",2) $d=1; While $d < UBound($temp, 1) _ArrayAdd($folders,$folders[$c]&"/"&$temp[$d]) $d=$d+1; WEnd $c=$c+1; WEnd _ArrayDelete($folders, 0) _ArraySort($folders); return $folders; EndFunc Edited January 3, 2007 by suppa2 Link to comment Share on other sites More sharing options...
yidabu Posted January 25, 2007 Share Posted January 25, 2007 I write a autoit udf to suport subdirectory and suport RegExp, see:http://www.autoitscript.com/forum/index.php?showtopic=40063 my UDF:myReplaceStringInFile suport StringRegExp and subdirectorymyFileListToArray suport StringRegExp and subdirectorymyImageIdentify get all information from image, use Image Magick com supportautoit in Chinaautoit 论坛yidabu成功社区 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now