You just use the File WriteLine:
#include <String.au3>
#include <Array.au3>
Global $listing, $timer
$directory = FileSelectFolder("Browse for Folder.", "")
$timer = TimerInit()
list($directory, 0)
time()
Func list($path = "", $counter = 0)
$counter = 0
$path &= '\'
Local $list_files = '', $file, $demand_file = FileFindFirstFile($path & '*')
If $demand_file = -1 Then Return ''
While 1
$file = FileFindNextFile($demand_file)
If @error Then ExitLoop
If @extended Then
If $counter >= 10 Then ContinueLoop
list($path & $file, $counter + 1)
Else
$listing &= $path & $file & "|"
FileWriteLine(@ScriptDir & "\listing.ini", $path & $file); Use this to list full path
;FileWriteLine(@ScriptDir & "\listing.ini", $file); Use this to list only the name
EndIf
WEnd
FileClose($demand_file)
EndFunc ;==>list
Func time()
Local $total_time = TimerDiff($timer)
Local $minutes = Int(Mod($total_time, 3600000) / 60000)
Local $seconds = Int(Mod(Mod($total_time, 3600000), 60000) / 1000)
Local $min_seg = StringFormat("%02d:%02d", $minutes, $seconds)
MsgBox(4096, 'Total time', $min_seg)
$listing = StringTrimRight($listing, 1)
$listing = _StringExplode($listing, "|", 0)
_ArraySort($listing)
_ArrayDisplay($listing, "files found")
EndFunc ;==>time