Minggu, 05 April 2020

SMALL BASIC: Folder and subfolder 2

Hi, SMALL BASIC programmer, welcome.

TextWindow.WriteLine("Please enter the start folder: ")
start[0] = TextWindow.Read()

'1. Take the 1st door
'Make start as an array
loop_start = 0
start:
TextWindow.Clear()
loop_start = loop_start + 1
TextWindow.WriteLine("This is start: " + start)
TextWindow.Pause()
TextWindow.WriteLine("This is the level depth: " + loop_start)
TextWindow.pause()
'TextWindow.WriteLine("This is start: " + start)
s_l = Array.GetItemCount(start) - 1
TextWindow.WriteLine("This is start length:" + s_l)

'Take all the 1st doors
'Remember that getdirectories start from 1
nbr_iterator = 0
For i = 0 To s_l
  'TextWindow.WriteLine("This is i for s_l: " + i)
  'TextWindow.Pause()
  fgd = File.GetDirectories(start[i])
  If fgd <> "" Or fgd <> "FAILED" Then
  ''Get fgd length
    f_l = Array.GetItemCount(fgd)
    'n_l = Array.GetItemCount(nbr) - 1
    TextWindow.WriteLine("This is the mother door: " + start[i])
    TextWindow.WriteLine("========================")
  For j = 1 To f_l
    nbr[nbr_iterator] = fgd[j]
    TextWindow.WriteLine("this is nbr index: " + nbr_iterator + "this is the son: " + nbr[nbr_iterator])
    'Program.Delay(1000)
    nbr_iterator = nbr_iterator + 1
    'TextWindow.WriteLine("this is nbr_iterator: " + nbr_iterator)
    'TextWindow.WriteLine("This is the value of index " + nbr_iterator + ": " + nbr[nbr_iterator])
    'Program.Delay(1000)
   EndFor
  Else
   
  EndIf
 
EndFor

TextWindow.WriteLine(nbr)
TextWindow.Pause()

'4. Count the length of nbr and route based on the length wether it goes up again or end of program
n_l = Array.GetItemCount(nbr) - 1
If n_l <= 0 Then
  TextWindow.WriteLine("End of the program")
  Goto eop
Else
  'Fill the total array with nbr element so later nbr element will be cleared
  'Get the last element of the total array
  t_l = Array.GetItemCount(total)
 
  For i = 0 To n_l
    total[t_l + i] = nbr[i]
   TextWindow.writeline(total[t_l+i])
  EndFor
 
  start = nbr
  nbr = ""
  Goto start
EndIf
eop:
TextWindow.WriteLine(nbr)

 
 






Tidak ada komentar:

Posting Komentar