Basicprogramming(.org) > General questions and discussions

Dir Walk Challenge

<< < (3/4) > >>

B+:
see attached

Well I knew John couldn't answer my question. This is probably his real reason for leaving, this challenge.

And the attached shows the Standard response when you ask a question he can't answer about Script Basic and he is the one who wants to be surrounded by professional programmers.





jj2007:
Just for fun - pure assembly, of course:
--- Code: ---include \masm32\MasmBasic\MasmBasic.inc
  Init
  Let esi=ExpandEnv$("%WINDIR%\")+"*.*" ; usually C:\Windows
  PrintLine "Searching ", esi
  GfCallback cbGetFiles ; define a callback function
  GetFiles esi
  Print Str$("\n%i files found\n", eax) ; 2805 files found
  For_ ecx=0 To Min(19, Files$(?)) ; print a few
PrintLine Files$(ecx)
  Next
  Store "NumericalFiles.txt", Files$() ; write the complete list to disk
  Exit
cbGetFiles:
  test ecx, 1048575 ; file or folder counter
  If_ Zero? Then Print "*" ; console mode progress bar ;-)
  .if [ebx.WIN32_FIND_DATAW.dwFileAttributes]==FILE_ATTRIBUTE_DIRECTORY
clc
  .else
void Val(Utf8$(esi))
.if edx==-127
stc
.elseif edx<20
clc
.else
stc
.endif
  .endif
  ret
EndOfCode
--- End code ---
Typical output:
--- Code: ---Searching C:\Windows\*.*
************************************************************************************************
******************************************
2805 files found
C:\Windows\Downloaded Installations\{32641B63-651D-43D9-B6F7-8C45F2FF07E1}\1033.MST
C:\Windows\ehome\CreateDisc\Components\tables\1cb0
C:\Windows\ehome\CreateDisc\Components\tables\1cb1
C:\Windows\ehome\CreateDisc\Components\tables\1cb2
C:\Windows\ehome\CreateDisc\Components\tables\2cb0
C:\Windows\ehome\CreateDisc\Components\tables\2cb1
C:\Windows\ehome\CreateDisc\Components\tables\2cb2
C:\Windows\inf\1394.inf
C:\Windows\inf\1394.PNF
C:\Windows\inf\61883.inf
C:\Windows\inf\61883.PNF
C:\Windows\Performance\WinSAT\DataStore\0012-01-16 10.43.33.070 Cpu.Assessment (Prepop).WinSAT.xml
C:\Windows\Performance\WinSAT\DataStore\0012-01-16 10.43.33.070 Disk.Assessment (Prepop).WinSAT.xml
C:\Windows\Performance\WinSAT\DataStore\0012-01-16 10.43.33.070 DWM.Assessment (Prepop).WinSAT.xml
...
--- End code ---

Tomaaz:
To list all files, all you need in Ruby is:

--- Code: ---puts Dir.glob("**/*")
--- End code ---

B+:
Hey JJ,

Nice to see MasmBasic in action again. Are the files coming out sorted automatically?



Hi all,

Last night I rediscovered this crucial line for QB64 processing of pathedfile lists:

--- Code: ---SHELL _HIDE "DIR " + spec$ + " /b /s /o:gen > " + TmpFile$
--- End code ---

Which brings back fond memories of my days with DOS.

chrisws:

--- Quote from: B+ on September 24, 2018, 07:06:52 PM ---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.

--- End quote ---

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

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

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version