sensalim Posted May 15, 2008 Posted May 15, 2008 my folder, let's say c:\ has 3 jpg files. I want to use this function to make an array. so I use $filelist = _FileListToArray("C:\", "*.jpg", 1) but it spits out @error (4) - No File(s) Found. How come?
Zedna Posted May 15, 2008 Posted May 15, 2008 Try: $filelist = _FileListToArray("C:", "*.jpg", 1) Resources UDF ResourcesEx UDF AutoIt Forum Search
monoceres Posted May 15, 2008 Posted May 15, 2008 my folder, let's say c:\ has 3 jpg files. I want to use this function to make an array.so I use$filelist = _FileListToArray("C:\", "*.jpg", 1)but it spits out @error (4) - No File(s) Found.How come?Maybe the files are named ~something.jpeg? Broken link? PM me and I'll send you the file!
Zedna Posted May 15, 2008 Posted May 15, 2008 (edited) Here is reason: Func _FileListToArray($sPath, $sFilter = "*", $iFlag = 0) Local $hSearch, $sFile, $asFileList[1] If Not FileExists($sPath) Then Return SetError(1, 1, "") If (StringInStr($sFilter, "\")) Or (StringInStr($sFilter, "/")) Or (StringInStr($sFilter, ":")) Or (StringInStr($sFilter, ">")) Or (StringInStr($sFilter, "<")) Or (StringInStr($sFilter, "|")) Or (StringStripWS($sFilter, 8) = "") Then Return SetError(2, 2, "") If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") $hSearch = FileFindFirstFile($sPath & "\" & $sFilter) If $hSearch = -1 Then Return SetError(4, 4, "") While 1 $sFile = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf If $iFlag = 1 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") <> 0 Then ContinueLoop If $iFlag = 2 And StringInStr(FileGetAttrib($sPath & "\" & $sFile), "D") = 0 Then ContinueLoop ReDim $asFileList[uBound($asFileList) + 1] $asFileList[0] = $asFileList[0] + 1 $asFileList[uBound($asFileList) - 1] = $sFile WEnd FileClose($hSearch) Return $asFileList EndFunc ;==>_FileListToArray So your Path musn't end with "\" EDIT: Unfortunatelly this is not described in HelpFile But it can be easily handled inside this UDF. I will create BUG ticket on BugTrack about that Edited May 15, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
monoceres Posted May 15, 2008 Posted May 15, 2008 (edited) So your Path musn't end with "\"It works for me with a trailing '\' Edited May 15, 2008 by monoceres Broken link? PM me and I'll send you the file!
weaponx Posted May 15, 2008 Posted May 15, 2008 It works for me with a trailing '\' Was this using a root path or an actual folder?
monoceres Posted May 15, 2008 Posted May 15, 2008 Was this using a root path or an actual folder?Tested with both Broken link? PM me and I'll send you the file!
Zedna Posted May 15, 2008 Posted May 15, 2008 (edited) Was this using a root path or an actual folder?Yes I can confirm trailing backslash makes problems only on ROOT dir.I think it's the same as my previously reported bughttp://www.autoitscript.com/forum/index.ph...st&p=443203It's fixed in 3.2.11 beta EDIT: it was only on WIN9x Edited May 15, 2008 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
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