News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Copy into Files$

Started by clamicun, September 03, 2017, 11:24:54 PM

Previous topic - Next topic

jj2007

Quote from: clamicun on September 06, 2017, 10:37:40 AM
GetFiles you have to do every time for a different filetype
GetFiles C:\Windows\*.txt  GetFiles C:\Windows\*.exe ....

You don't need that:

include \masm32\MasmBasic\MasmBasic.inc         ; download
  Init
  GfNoRecurse=1                 ; for this test, don't dive into subfolders
  GetFiles C:\Windows\System32\a*.exe|b*.dll|*.scr      ; use the "or" character to separate search masks
  For_ ecx=0 To eax-1           ; print the results
       PrintLine Str$(GfSize(ecx)), Tb$, GfDate$(ecx), Spc2$, GfTime$(ecx), Tb$, Files$(ecx)
  Next
EndOfCode


Output (a*.exe, b*.dll, all screen savers):38912   14.07.2009  03:14:11    C:\Windows\System32\AdapterTroubleshooter.exe
172224  21.08.2013  22:06:34    C:\Windows\System32\appverif.exe
20992   14.07.2009  03:14:12    C:\Windows\System32\ARP.EXE
24064   14.07.2009  03:14:12    C:\Windows\System32\at.exe
29184   14.07.2009  03:14:12    C:\Windows\System32\AtBroker.exe
16384   14.07.2009  03:14:12    C:\Windows\System32\attrib.exe
50176   07.07.2017  16:51:57    C:\Windows\System32\auditpol.exe
668160  21.11.2010  04:23:53    C:\Windows\System32\autochk.exe
679424  21.11.2010  04:23:48    C:\Windows\System32\autoconv.exe
658944  21.11.2010  04:23:53    C:\Windows\System32\autofmt.exe
144768  21.11.2010  04:24:28    C:\Windows\System32\basecsp.dll
740864  21.11.2010  04:23:54    C:\Windows\System32\batmeter.dll
82944   07.07.2017  17:11:12    C:\Windows\System32\bcrypt.dll
249352  12.05.2016  15:04:55    C:\Windows\System32\bcryptprimitives.dll
34304   14.07.2009  03:14:59    C:\Windows\System32\bidispl.dll
171520  14.07.2009  03:14:59    C:\Windows\System32\BioCredProv.dll
19456   21.11.2010  04:24:01    C:\Windows\System32\bitsperf.dll
10752   14.07.2009  03:14:59    C:\Windows\System32\bitsprx2.dll
10240   14.07.2009  03:14:59    C:\Windows\System32\bitsprx3.dll
9216    14.07.2009  03:14:59    C:\Windows\System32\bitsprx4.dll
18432   14.07.2009  03:14:59    C:\Windows\System32\bitsprx5.dll
10240   14.07.2009  03:14:59    C:\Windows\System32\bitsprx6.dll
744960  14.06.2016  17:21:18    C:\Windows\System32\blackbox.dll
21584   14.07.2009  03:26:15    C:\Windows\System32\BOOTVID.DLL
41984   04.07.2012  23:14:34    C:\Windows\System32\browcli.dll
10752   21.11.2010  04:24:00    C:\Windows\System32\browseui.dll
66560   14.07.2009  03:15:00    C:\Windows\System32\btpanui.dll
64000   14.07.2009  03:15:00    C:\Windows\System32\BWContextHandler.dll
10752   14.07.2009  03:15:00    C:\Windows\System32\BWUnpairElevated.dll
878592  21.11.2010  04:25:09    C:\Windows\System32\Bubbles.scr
221184  21.11.2010  04:25:09    C:\Windows\System32\Mystify.scr
413696  21.11.2010  04:25:14    C:\Windows\System32\PhotoScreensaver.scr
220672  21.11.2010  04:25:09    C:\Windows\System32\Ribbons.scr
10240   14.07.2009  03:14:09    C:\Windows\System32\scrnsave.scr
293888  21.11.2010  04:25:09    C:\Windows\System32\ssText3d.scr


QuoteSo the idea is to store the folders of C:\ in the storefile  and read it into an array if you need it.
That is faster than to count the folders again.

Seems this does it.

Dim folderarray$()
Let esi=FileRead$("Folders_C.txt") 
StringToArray esi,folderarray$()

And do the same as above
INVOKE lstrcpy,offset path_file_type,folderarray$(ecx)
INVOKE lstrcat,offset path_file_type,offset slash             ;+ slash
INVOKE lstrcat,offset path_file_type,offset file_type         ;FileType *.xxx anhängen

Of course you have to renew the storefile once in a while.

Reasonable idea :t

Dim folderarray$()
Let esi=FileRead$("Folders_C.txt") 
StringToArray esi,folderarray$()


can be replaced by
Recall "Folders_C.txt", folderarray$()