Author Topic: Dir Walk Challenge  (Read 6676 times)

B+

  • Guest
Re: Dir Walk Challenge
« Reply #15 on: September 29, 2018, 03:15:38 AM »
Well I finally got a useful directory walk working from SmallBASIC.
Chris has a Keyword DIRWALK but it isn't easy for me to use but I bet Chris could extract 100 x's faster than I.

When you launch SmallBASIC you are actually looking at the output from the DIRWALK command.

(SmallBASIC runs main.bas which provides the user interface)



Ah! I knew that all that extraction wasn't needed!

Code: [Select]
'Dir Walk 2.bas for SmallBASIC 0.12.13 B+ 2018-09-28

FUNC sto(x)
  if right(lcase(x.name), 4) = ".bas"
    pathname = iff( x.depth > 0, (x.path + chr(92) + x.name), (x.path + x.name))
    container << pathname
  fi
  sto = TRUE
END

DIRWALK "." USE sto(x)
SORT container
'check and file results
FOR i IN container DO ? i
tsave "BAS files.txt", container

Same output results.
« Last Edit: September 29, 2018, 03:35:10 AM by B+ »

jj2007

  • Guest
Re: Dir Walk Challenge
« Reply #16 on: June 21, 2019, 11:41:17 AM »
Nice to see MasmBasic in action again. Are the files coming out sorted automatically?

Hi B+,

No, GetFiles doesn't sort automatically, but SortFiles will do that, and it has quite a number of useful options.

B+

  • Guest
Re: Dir Walk Challenge
« Reply #17 on: June 22, 2019, 11:20:32 PM »
Wow! took awhile to give birth to an answer. ;-))

My files list is coming in handy finding a SmallBASIC file that I know I have somewhere among the 1000's.

jj2007

  • Guest
Re: Dir Walk Challenge
« Reply #18 on: July 11, 2019, 10:38:52 PM »
Wow! took awhile to give birth to an answer. ;-))

Apologies - I found your post by accident. I confess that I visit this forum only occasionally...