Jump to content

FileGetTime in _ArrayDisplay


Recommended Posts

#Include <File.au3>
#Include <Array.au3>
$FileList=_FileListToArray( @ScriptDir , "*.txt", 1 )
If @Error=1 Then
    MsgBox (0,"","No Files\Folders Found.")
    Exit
EndIf
_ArrayDisplay($FileList,"$FileList")

that will geave me the list of all txt files in the script folder

So how to add the time of creation 4 all txt files in next Array row with FileGetTime("", 1) command?

I understand how to write in second row with _ArrayDisplay but still i dont know how to combine FileGetTime with _FileListToArray so that i can have time 4 every file?

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Hi,

Try

; _FileListToArrayTime.au3
#Include <File.au3>
#Include <Array.au3>
$FileList = _FileListToArray(@ScriptDir, "*.txt", 1)
Local $ar_FileList2D[UBound($FileList) ][4]
If @error = 1 Then
    MsgBox(0, "", "No Files\Folders Found.")
    Exit
EndIf
For $i = 1 To UBound($FileList) - 1
    $ar_FileList2D[$i][0] = $FileList[$i]
    $ar_FileList2D[$i][2] = Round(FileGetSize($FileList[$i]) *1000/ 1048576, 2)
    local $i_posDot = StringInStr($FileList[$i], ".", 0, -1),$fgtime = "Unknown",$fgtime = FileGetTime($FileList[$i])
    If @error <> 1 Then $ar_FileList2D[$i][1] = $fgtime[0] & "-" & $fgtime[1] & "-" & $fgtime[2] & ", " & $fgtime[3] & ":" & $fgtime[4];~   if $i_InternationalDateF then
    If $i_posDot Then $ar_FileList2D[$i][3] = StringMid($FileList[$i], $i_posDot + 1)
Next
_ArrayDisplay($ar_FileList2D, "$FileList")
Best, Randall
Link to comment
Share on other sites

ty 4 this

#Include <File.au3>
#Include <Array.au3>
$FileList = _FileListToArray(@ScriptDir, "*.txt", 1)
Local $ar_FileList2D[UBound($FileList) ][2]
If @error = 1 Then
    MsgBox(0, "", "No Files\Folders Found.")
    Exit
EndIf
For $i = 1 To UBound($FileList) - 1
    $ar_FileList2D[$i][0] = $FileList[$i]
    local $i_posDot = StringInStr($FileList[$i], ".", 0, -1),$fgtime = "Unknown",$fgtime = FileGetTime($FileList[$i])
    If @error <> 1 Then $ar_FileList2D[$i][1] = $fgtime[0] & "/" & $fgtime[1] & "/" & $fgtime[2]
    Next
_ArrayDisplay($ar_FileList2D, "$FileList")

i still dono one thing, where did you finde $i_posDot and how you use it heare, is it something in Array.au3 or only with local command? :whistle:

and is there way to srot it on date colom rows becose i have some problems with _ArraySort command and error in line 680 in array.au3 file?

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

Hi,

$i_PosDot was just a variable name I made up and use that string function to find the strat of the extension in the filenames; not needed for time.

Here is the sort.. ?is that what you meant??

; filedetailarray2.au3
#Include <File.au3>
#Include <Array.au3>
$FileList = _FileListToArray(@ScriptDir, "*.txt", 1)
Local $ar_FileList2D[UBound($FileList) ][2]
If @error = 1 Then
    MsgBox(0, "", "No Files\Folders Found.")
    Exit
EndIf
For $i = 1 To UBound($FileList) - 1
    $ar_FileList2D[$i][0] = $FileList[$i]
    Local $fgtime = "Unknown", $fgtime = FileGetTime($FileList[$i])
    If @error <> 1 Then $ar_FileList2D[$i][1] = $fgtime[0] & "/" & $fgtime[1] & "/" & $fgtime[2]
Next
;~ _ArraySort($ar_FileList2D, 0, 1, UBound($ar_FileList2D), UBound($ar_FileList2D, 0), 1); ascending
;~ _ArrayDisplay($ar_FileList2D, "Ascending $FileList")
_ArraySort($ar_FileList2D, 1, 1, UBound($ar_FileList2D), UBound($ar_FileList2D, 0), 1); descending
_ArrayDisplay($ar_FileList2D, "Descending $FileList")
Randall
Link to comment
Share on other sites

it is, ty alot Randall 4 your help.

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
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...