Page 1 of 1 1
Topic Options
#158 - 1999-06-30 01:57 AM Searching for files on local machine
Anonymous
Unregistered


Hi,

I am updating users machines for Year 2000 compliance by installing patches remotely via network logon scripts.

Some patches require that specific files be replaced. My problem is that out of 250 PCs, these files are going to be in close to 250 different locations (so much for a standard operating environment!). I need to be able to do the equivalent of a "Find Files" so I can find the files to replace.

Any ideas? I thought of executing a "dir filename /s" command and some how extracting the string, but I don't like my chances of it working correctly.

Also - some users are having problems after patches are installed. It seems that after an executeable patch is called (at the end of the script), when it is finished, the PC has tried to disconnect from the netlogon direcory and they get an error asking if they are sure they want to delete the drive. It only happens on some PCs, and only happens after other programs are run (happens on different patches). Any ideas on that?

Thanks for any help you can provide!

Top
#159 - 1999-07-02 05:36 AM Re: Searching for files on local machine
Anonymous
Unregistered


The following should work:
code:

; file you are searching for
$filename = "anyfilename.exe"
; directory to start your search
$startdir = "c:\"
; temporary file for search results
$tmpfile = "c:\temp\results.txt"

; write search results to temporary file.
CD "$startdir"
SHELL "cmd.exe /c dir /s /b $filename > $tmpfile"

; read results from temporary file.
OPEN(1,$tmpfile,2)
$string = READLINE(1)
WHILE @ERROR = 0

; split the result in path and filename.
$path = ""
$file = $string
WHILE INSTR($file,"\")
$path = $path + SUBSTR($file,1,INSTR($file,"\"))
$file = SUBSTR($file,INSTR($file,"\")+1,LEN($file))
LOOP

; $file = the filename
; $path = the path (including a backslash at the end).
; use the following line to remove the final backslash,
; but not when te result is the root of a drive.
; IF (LEN($path) > 3) $path = SUBSTR($path,1,LEN($path)-1) ENDIF
;
; write here what you want to do with the results.

; read the next result.
$string = READLINE(1)
LOOP
CLOSE(1)
DEL $tmpfile


------------------
With kind regards,
Taco Ditiecher.

Top
#160 - 1999-07-03 08:37 AM Re: Searching for files on local machine
Anonymous
Unregistered


I've have a similar problem, but I have user with multiple local drives and the files that need to be update could be on any of them. Is there a function or procedure that could give me the local hard drives and not local CD-ROM drives.
Top
#161 - 1999-07-07 04:03 AM Re: Searching for files on local machine
Anonymous
Unregistered


This is an answer to the disconnection problem.

I am guessing you use run to start the executable. Only run does not wait for the executable to end and continues processing the logonscript. At the end of the logonscript the netlogon directory gets disconnected. If this happens before the executable is finished you get your errormessage.

To prevent this use shell. This will wait for the executable to finish before processing the rest of the script.

Hope this helps

------------------

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1343 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.047 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org