Like after it’s finished recursing into folders, how does it -1 on the Int value? The flow of the script itself is confusing
Code: Select all
Global strFile := A_ScriptDir . "\Liste.txt"
FileDelete, %strFile%
SetWorkingDir, C:\Program Files
Sub(A_WorkingDir . "\*.*", 0)
run, %strFile%
ToolTip,
Exit
Sub(strDir, intLevel)
{
ToolTip, Level #%intLevel% %strDir%
Loop, %intLevel%
strTabs := strTabs . A_Tab
Loop, %strDir%, 2 ; scan folders
{
FileAppend, %strTabs%\%A_LoopFileName%`n, %strFile%
Sub(A_LoopFileFullPath . "\*.*", intLevel + 1) ; Recurse to subdirectory
}
Loop, %strDir%, 0 ; now scan files only
{
FileAppend, %strTabs%\%A_LoopFileName%`n, %strFile%
}
}