Jump to content

FileFindNextFile() problems


Recommended Posts

Why this function doesnt work?

Its supposed to make a list of all files found in a specific directory , but it only finds the first file or maybe the second.

thanks,

;+++++++++++++++++++++

Global $file , $ret

$ret = _makefileslist( @ScriptDir & '\' , '*.txt' , $file , 10 )

Func _makefileslist( $path, $find , ByRef $array , $max )

;##this function will DIM $array $max times and make a list of files found.###

;### if failed will return -1 else the number fo files found.

Dim $array[$max + 1]

Local $a = 0

$array[1] = FileFindFirstFile( $path&$find )

If $array[1] = -1 Then ;Exit on if not found

FileClose($array[1])

Return -1

Else

Do ;Loop untill no more files found or $a = $max

$a = $a + 1

$array[$a] = FileFindNextFile($array[1])

If @error = 1 Then

FileClose($array[1])

Return $a - 1

EndIf

Until $a = $max

EndIf

EndFunc

;----------------------------------------------------------------

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

Yup that surely helped, thanks 'Valuater' .

maybe you should look into

FileListToArray()

in help

8)

"When the power of love overcomes the love of power, the world will know peace"-Jimi Hendrix

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...