Deye Posted February 12, 2016 Posted February 12, 2016 (edited) I needed this the other day to avoid repetitions of a function that deals with the stripped path of what before "\" (..reading The array) expandcollapse popup#include <Array.au3> #include <File.au3> Global $aTemp, $collect Local $aMain[1] = [0] $aDrives = DriveGetDrive("All") If IsArray($aDrives) Then For $i = 1 To $aDrives[0] $aDrives[$i] = StringUpper($aDrives[$i]) $aTemp = _FileListToArrayRec($aDrives[$i] & "\", "*", 0, 0, 0, 2) If IsArray($aTemp) Then _sort() _ArrayConcatenate($aMain, $aTemp, 1) EndIf Next EndIf _ArrayDisplay($aMain) Func _sort() For $i = UBound($aTemp) - 1 To 1 Step -1 StringReplace($aTemp[$i], "\", "\") If @extended = 1 Then $collect = $aTemp[$i] $aTemp[$i] = "" Do $i -= 1 StringReplace($aTemp[$i], "\", "\") If @extended = 1 Then $collect &= "," & $aTemp[$i] $aTemp[$i] = "" EndIf Until $i = 0 EndIf Next For $k = UBound($aTemp) - 1 To 1 Step -1 If $aTemp[$k] = "" Then Local $i = $k Do $k -= 1 If $aTemp[$k] <> "" Then $aTemp[$i] = $aTemp[$k] $aTemp[$k] = "" $i -= 1 EndIf Until $k = 0 EndIf Next If $collect <> "" Then Local $split = StringSplit($collect, ",") For $a = UBound($split) - 1 To 1 Step -1 $aTemp[$a] = $split[UBound($split) - $a] Next $collect = "" EndIf EndFunc Edited February 12, 2016 by Deye
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