; IF setconsole("hide") ; ENDIF ; ; NT/95 search for specified file(mask)s - Kixtart 3.63, 4.00 ; ; (c) scripting@wanadoo.nl 2001 ; ; vs 1.03 - program ; ; 1.00 (20010525) original version ; 1.01 (20010701) - fix: no limit to length of variable names ; ($number_of_directories => $number_of_dirs) ; 1.02 (20010710) - standardization of $debug_file value ; 1.03 (20011120) - suppress SetConsole("hide") ; $prgrm_version="1.03" ; $tmp_directory=ExpandEnvironmentVars("%tmp%") IF (substr($tmp_directory,len($tmp_directory),1) <> "\") $tmp_directory=$tmp_directory+"\" ENDIF ; -------------------------------------------------------------------------- ; - - ; -------------------------------------------------------------------------- ; 1. specifies directories to check ; 2. specifies files to check ; --------------------------------------------------------------------------- ; user definable part ; --------------------------------------------------------------------------- $debug_mode="yes" ; - yes/no - no = no user output will be viewed $debug_file=$tmp_directory+"kix-info.log" $number_of_dirs=3 ; <- increase value by new dirs to look in DIM $dirs[$number_of_dirs+1] $dirs[1]="%windir%" $dirs[2]="c:\util\kixtart.363" $dirs[3]="c:\util\kixtart.400" $number_of_files=7 ; <- increase value by new files to check for DIM $files[$number_of_files+1] $files[1]="kix32.exe" $files[2]="kix32c.exe" $files[3]="kx16.dll" $files[4]="kx32.dll" $files[5]="kx95.dll" $files[6]="kxrpc.exe" $files[7]="*.kix" ; --------------------------------------------------------------------------- ; ; --------------------------------------------------------------------------- $tmp_file=$tmp_directory+"kixtart.tmp" ; IF (Exist($debug_file) = 1) del $debug_file ENDIF IF ($debug_mode = "yes") IF (RedirectOutput($debug_file) <> 0) ENDIF ENDIF ? "KIX-SearchFiles "+@kix+" (vs "+$prgrm_version+")"+" "+@date+" "+@time ? IF (Exist($tmp_file) = 1) del $tmp_file ENDIF $eof="~~~ The command completed succesfully ~~~" ; $i=1 WHILE ($i <= $number_of_dirs) $k=1 IF (Substr($dirs[$i],len($dirs[$i]),1) <> "\") $dirs[$i]=$dirs[$i]+"\" ENDIF IF ($debug_mode = "yes") ? "check directory: "+$dirs[$i] ENDIF WHILE ($k <= $number_of_files) $entry=$dirs[$i]+$files[$k] IF (exist($dirs[$i]) = 1) SHELL "%comspec% /c dir "+CHR(34)+$entry+CHR(34)+" /a /b /o:n /s >>"+$tmp_file ENDIF $k=$k+1 LOOP $i=$i+1 LOOP SHELL "%comspec% /c echo "+$eof+">>"+$tmp_file ? "check files: "+$files[1] $i=2 WHILE ($i <= $number_of_files) ? " "+$files[$i] $i=$i+1 LOOP ? $count=0 IF (Exist($tmp_file) = 1) IF (Open(1,$tmp_file,2) = 0) $completed="no" WHILE ($completed <> "yes") $result=Readline(1) IF (@error <> 0) or (instr($result,$eof) <> 0) $completed="yes" ELSE IF (exist($result) = 1) $count=$count+1 GOSUB show_file_info ENDIF ENDIF LOOP IF Close(1) ENDIF ENDIF ENDIF IF (Exist($tmp_file) = 1) del $tmp_file ENDIF ? IF ($count = 0) ? "completed. found no entries." ELSE ? "completed. found "+$count+" entries." ENDIF ? IF (RedirectOutput("") <> 0) ENDIF IF ($debug_mode = "yes") ? "Informative SearchFiles: output written to file '"+$debug_file+"'." ENDIF EXIT :show_file_info $fattr="" IF GetFileAttr($result) & 1 ; - readonly - $fattr=$fattr+"r" ELSE $fattr=$fattr+"." ENDIF IF GetFileAttr($result) & 2 ; - hidden - $fattr=$fattr+"h" ELSE $fattr=$fattr+"." ENDIF IF GetFileAttr($result) & 4 ; - system - $fattr=$fattr+"s" ELSE $fattr=$fattr+"." ENDIF IF GetFileAttr($result) & 16 ; - directory - $fattr=$fattr+"d" ELSE $fattr=$fattr+"." ENDIF IF GetFileAttr($result) & 32 ; - archive - $fattr=$fattr+"a" ELSE $fattr=$fattr+"." ENDIF ; IF GetFileAttr($result) & 16 ; - directory - $fsize="" ELSE $fsize=GetFileSize($result) ENDIF $fsize=substr(" ",1,10-len("$fsize"))+$fsize $ftime=GetFileTime($result) ; ? $fattr+" "+$fsize+" "+$ftime+" "+$result RETURN