﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
2045	FileFindNextFile advanced parameter	money		"

{{{
 FileFindNextFile
 --------------------------------------------------------------------------------
 Returns a filename according to a previous call to FileFindFirstFile.

 FileFindNextFile ( search, [advanced = 0] )

 Parameters

    search - The search handle, as returned by FileFindFirstFile.

    advanced
      0 = returns a filename according to a previous call to FileFindFirstFile.

      1 = returns an array containing the filename and extended information.


	When using the ""advanced"" parameter the information is returned in an array
	+ with extended information:

        $array[0] = filename
        $array[1] = 8.3 filename (same as FileGetShortname(file))
        $array[2] = size of the file (same as FileGetSize(file))
        $array[3] = file attribute (same as FileGetAttrib(file))
        $array[4] = date modified (same as FileGetTime(file, 0, 1) )
        $array[5] = date created (same as FileGetTime(file, 1, 1))
        $array[6] = date accessed (same as FileGetTime(file, 2, 1))

}}}

The advanced parameter would remove the need to use 6 additional File* calls to get
+ the information we're after and add negligible time because this would be handled
+ internally by AutoIt. 

Basically what FindFirstFile/FindNextFile returns, except the values correspond
+ with the other File* functions. e.g. FileGetAttrib()
	
Of course this would be fully backwords compatible with existing scripts
+ If the advanced parameter is 0 (default) then returns just the filename.


--------------------------------------
Here we have decent speed with FileFind* used alone, but once we need to dig out
+ additional information, things start to noticably slow down.

{{{
$time = TimerInit()
_Example(@WindowsDir, False)
ConsoleWrite(""name only - completed (ms): ""& Round(TimerDiff($time), 4)  &@lf)

$time = TimerInit()
_Example(@WindowsDir, True)
ConsoleWrite(""extended - completed (ms): ""& Round(TimerDiff($time), 4)  &@lf)


Func _Example($sPath, $bExtended = False)
	Local $hFind = FileFindFirstFile($sPath & ""\*.*"")


	Local $aFile[7], $sFile

	If @error Or $hFind = -1 Then Return SetError(1, 0, 0)

	While 1

		$sFile = FileFindNextFile($hFind)
		If @error Or $sFile = -1 Then ExitLoop

		; skip folders
		If Not @extended Then

			$aFile[0] = $sFile

			; These 6 functions significantly impact search time.
			; FileFindNextFile with advanced parameter would
			; remove the need for these additional file calls
			If $bExtended Then
				$aFile[1] = FileGetShortName($sPath &""\""& $sFile)
				$aFile[2] = FileGetSize($sPath &""\""& $sFile)
				$aFile[3] = FileGetAttrib($sPath &""\""& $sFile)
				$aFile[4] = FileGetTime($sPath &""\""& $sFile, 0, 1)
				$aFile[5] = FileGetTime($sPath &""\""& $sFile, 1, 1)
				$aFile[6] = FileGetTime($sPath &""\""& $sFile, 2, 1)
			EndIf

;~ 			ConsoleWrite( _
;~ 			'-----------------------------'&@LF& _
;~ 			'name: '& $aFile[0] &@LF& _
;~ 			'short name: '& $aFile[1] &@LF& _
;~ 			'size: '& $aFile[2] &@LF& _
;~ 			'attribute: '& $aFile[3] &@LF& _
;~ 			'date modified: '& $aFile[4] &@LF& _
;~ 			'date created: '& $aFile[5] &@LF& _
;~ 			'date accessed: '& $aFile[6] &@LF)
		EndIf

	WEnd

	FileClose($hFind)
EndFunc
}}}"	Feature Request	closed		AutoIt		None	Rejected		
