Using SrchInit for 2 Filetypes
Keywords:
Question:
What is the most efficient way to search an entire hard disk for two filetypes? I want to avoid two complete scans which is what I think is happening now. Currently I scan for one type, *.LNK, then for the other, *.PIF. Here is the main part of my code:AddExtender("wsrch34I.dll") ;*** Scan HD for PIF & LNK Files ;*** Change UNC Names to P: ;*** Change "Smart" Icons to "Dumb" drives = DiskScan(2) drvnum = ItemCount(drives,@TAB) chk = StrLower("\\nt000036\programs") lgth_chk = StrLen(chk) For d = 1 to drvnum drv = ItemExtract(d,drives,@TAB) drvroot = StrCat(drv,"\") For x = 1 to 2 If x == 1 then search = "*.LNK" Else search = "*.PIF" handle1 = srchInit(drvroot,search,"%chk%","",16) While 1 lnk = srchNext(handle1) if lnk == "" then Break Display(1,"Found",lnk) endwhile Next NextAnswer:
Something like searching for *.* and then checking what you got. See below.handle1 = srchInit(drvroot,"*.*",chk,"",16) While 1 lnk = srchNext(handle1) if lnk == "" then Break ext=strlower(FileExtension(lnk)) if ext!="pif" && ext!="lnk" then continue etc...The problem here is that *each* and *every* file on the system is "touched" and is likely to take MUCH MUCH MUCH longer that two separate scans.
Article ID: W12562Filename: Using SrchInit for 2 FileTypes.txt