Search the Community
Showing results for tags 'filelisttoarray'.
-
Greetings! I am in need of listing several files in a folder with its respective sizes. I found this script online, which works fine. However I'd like to insert the folder path as a variable in a dialog box. How can I replace @ScriptDir with my variable? Thanks in advance. $z = MsgBox(0,"Selected Folder",FileSelectFolder ( "Select Folder", "C:\")) ; THE VARIABLE I'D LIKE TO INCLUDE. #include <File.au3> #include <Array.au3> Local $aArray = _FileListToArrayRec(@ScriptDir, "*", $FLTAR_SORT, $FLTAR_FILES) ; ;~ _ArrayDisplay($aArray, "Sorted tree") Local $size_A[UBound($aArray)][2] For $i = 1 To UBound($aArray) -1 $size_A[$i][0] = $aArray[$i] $size_A[$i][1] = ByteSuffix(FileGetSize($aArray[$i])) Next ;~ _ArrayDisplay($size_A) _FileWriteFromArray(@ScriptDir & '\Tamanho.txt', $size_A, 1, Default, ' ') ShellExecute(@ScriptDir & '\Tamanho.txt') Func ByteSuffix($Bytes) Local $Index = 0, $aArray = [' bytes', ' KB', ' MB', ' GB', ' TB', ' PB', ' EB', ' ZB', ' YB'] While $Bytes > 1023 $Index += 1 $Bytes /= 1024 WEnd Return Round($Bytes, 2) & $aArray[$Index] EndFunc ;==>ByteSuffix
-
Hi, I'm using _FileListToArray to create an array listing .ini files in a specific folder, problem is, I want only the file named Settings.ini and any Files named Data#.ini where # is actually a number, I don't want any other .ini file that may be there even though it shouldn't be there to be included in the array. Is it possible to use multiple filters in _FileListToArray? or is there another way to do what I'm looking for? My current code: $IniList = _FileListToArray(@ScriptDir & "\Settings", "*.ini", 1, False) _ArraySort($IniList, 1, 1) _ArraySort($IniList, 0, 2) $IniOptions = _ArrayToString($IniList, "|", 1) Thank you.
-
Hi All, I am fairly new to AutoIT and I am still trying to learn, I have been using _FileListToArray to list all the files with a particular extension in an array and then loop through it for operation ( For $i = 1 To UBound($FileArray) - 1). So far this has been working fine. But I am not able to figure out a problem that I have; what if I have 50 files but I only want to loop through first 10 files and then next ten and so on? Or rather I should say, how I can I only feed max 10 files to the array at a time when I do _FileListToArray regardless of the total number of files in the folder? Any insight/help will be much appreciated
- 2 replies
-
- arrays
- filelisttoarray
-
(and 1 more)
Tagged with: