Notifications
Clear all

[Closed] Get Directories in Hierarchy?

Hello friends!
I want so much to get all subfolder of a folder, but ha would like to get it in this mode:
Folders:
Dir1
SubDir1.1
SubDir1.2
Dir2
SubDir2.1
SubDir2.2

I want to get in this array squeleton:
#(#(#(1.1),#(1.2)),#(#(2.1),#(2.2)))

How can i get?

2 Replies

Well, this isn’t quite the hierarchy structure you want… but maybe it’ll help get you started toward your goal:

global dir_array = #()
  
   fn getDirectoriesRecursive root =
  (
  	temp_array = GetDirectories (root+"/*")
  	for d = 1 to temp_array.count do (
  		temp_array[d] = substring temp_array[d] 1 (temp_array[d].count - 1)
  		append dir_array temp_array[d]
  		getDirectoriesRecursive (temp_array[d])
  	 )
  
  	 dir_array
  )
  
  getDirectoriesRecursive "C:/temp"

Thank you my friend!
This gives me all folders on the same array.
Is not my goal, but maybe is a way to get!
I think that has a way to do it with any hierarchy. I have to discover it.
Thank you!