0
votes

I'm looking to create an array of file names and their modified time. I can build the arrays separately. But how can I build this in a way to be like

[ [file1, modtime1], [file2, modtime2], ...]

Here is the script that builds each individual array.

modTime := []
filenames := []
counter := 1

Full_Path := "C:\Users\me\MyDocs\*.txt"

Loop, % 
  {
    modTime[counter]:=A_LoopFileTimeModified 
    filenames[counter]:=A_LoopFileFullPath 
    counter++
  }
    
loop % modTime.MaxIndex()
    items.= modTime[A_Index] "," 
StringLeft, items, items, Strlen(items)-1
msgbox % items

loop % filenames.MaxIndex()
    items.= filenames[A_Index] "," 
StringLeft, items, items, Strlen(items)-1
msgbox % items

return
1
Hate to say it, but isn't this exactly the same question as you already asked and I already answered here? Instead of coordinates, you just have something else now. MyArray.Push([A_LoopFileFullPath, A_LoopFileTimeModified]). Also, you're using a deprecated file loop, use Loop, Files instead.0x464e
You seem to be correct. Sorry, I have no recollection of asking that previous question. You did answer my question. It seems I abandon that project and never went back to review your answer, apologies for that.wetin

1 Answers

0
votes
modTime := []
counter := 1

Full_Path = % "C:\Users\me\MyDocs\*.txt"

Loop, % Full_Path
  {
    SplitPath, % A_LoopFileFullPath, file_name
    modTime.Push([file_name, A_LoopFileTimeModified])
    counter++
  }

For each, element in modTime
    items .= element[1] ", " element[2] "`n"
MsgBox, % RTrim(items, "`n")