Smokey Posted April 23, 2017 Posted April 23, 2017 Hello, please help me with this array, I'm trying to list files of different sub folders into different column's and it's making a lot of empty rows after the first column, I been trying close to 10 hours, and I can't figure out how to fix it so that it's always listed from the top. i'm aiming to list the folder of files, number of files, and then the files. I attached, the .au3 file, and screen capture of the current result with empty rows. thanks in advance, File_Array_Lists.au3
232showtime Posted April 23, 2017 Posted April 23, 2017 (edited) created same text file and folders expandcollapse popup#include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> AutoItSetOption("MouseCoordMode", 0) Local $LOCATON = "c:\Round_Loading" Local $FOLDERS = _FileListToArrayRec($LOCATON, "*", 2, 1, 1, 2) Local $FINAL[0][$FOLDERS[0]] = [[], []] Local $sFill_FOLDERS = "" Local $sFill_FILES = "" For $FOLDERS_COUNT = 1 To $FOLDERS[0] $sFill_FOLDERS &= $FOLDERS[$FOLDERS_COUNT] & "|" Next $sFill_FOLDERS = StringTrimRight($sFill_FOLDERS, 1) _ArrayAdd($FINAL, $sFill_FOLDERS) Local $FILES1 = _FileListToArrayRec($LOCATON & "\1", "*", 1, 1, 1, 2) Local $FILES2 = _FileListToArrayRec($LOCATON & "\2", "*", 1, 1, 1, 2) Local $FILES3 = _FileListToArrayRec($LOCATON & "\3", "*", 1, 1, 1, 2) For $i = 0 To UBound($FILES1) - 1 $combine = $FILES1[$i] & "|" & $FILES2[$i] & "|" & $FILES3[$i] _ArrayAdd($FINAL, $combine, 0) Next _ArrayDisplay($FINAL, "FINAL1") ;~ Exit Func Terminate() Exit EndFunc ;==>Terminate Edited April 23, 2017 by 232showtime ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon.
Subz Posted April 23, 2017 Posted April 23, 2017 (edited) You can try: #include <Array.au3> #include <File.au3> Local $LOCATON = InputBox("Locaton of Folders", "test", "D:\Round_Loading") Local $aFolders = _FileListToArrayRec($LOCATON, "*", 2, 1, 1, 2) If @error Then Exit Local $aFolderInfo[0][UBound($aFolders) - 1] Local $aFolderFiles _ArrayAdd($aFolderInfo, _ArrayToString($aFolders, "|", 1)) For $i = 0 To UBound($aFolderInfo, 2) - 1 $aFolderFiles = _FileListToArrayRec($aFolderInfo[0][$i], "*", 1, 0, 1, 2) If @error Then ExitLoop If $aFolderFiles[0] >= UBound($aFolderInfo) + 1 Then ReDim $aFolderInfo[$aFolderFiles[0] + 2][UBound($aFolderInfo, 2)] For $j = 0 To $aFolderFiles[0] $aFolderInfo[$j + 1][$i] = $aFolderFiles[$j] Next Next _ArrayDisplay($aFolderInfo) Edited April 23, 2017 by Subz Smokey 1
232showtime Posted April 23, 2017 Posted April 23, 2017 oh shoot,no. of items inside my folder are same... ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon.
Smokey Posted April 23, 2017 Author Posted April 23, 2017 Subz thank you for the solution it works! and 232showtime thank you for trying again many thanks to both of you!!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now