Page 1 of 1 1
Topic Options
#48332 - 1999-10-11 02:47 AM How to test if a file exist on the client PC
Anonymous
Unregistered


I've a bout 5 files to copy to the workstation which are logging to the server,
But, I'd like to test first if the files are already in the workstation.
I've tested :
if not exists "%systemroot%\system32\myfile.dll"
but it doesn't work.

Do you have any suggestions ?
Thanks,
Jacques JOCELYN

Top
#48333 - 1999-10-11 04:29 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


Hi Jacques

Do it from a batch file. I copy the Kixtart files over to the workstations using the following. It's not one I wrote so I won't take any praise for it!

IF "%OS%" == "Windows_NT" GOTO WinNT
REM * If can't detect WinNT, assume system is Win95/98
rem XCOPY %0\..\KXRPC.EXE %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
XCOPY %0\..\KIX32.EXE %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
XCOPY %0\..\KX16.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
XCOPY %0\..\KX32.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
XCOPY %0\..\KX95.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
XCOPY %0\..\vip.scr %WINDIR%\ /D /V > NUL
XCOPY %0\..\logo_on.bmp %WINDIR%\ /D /V > NUL
%WINDIR%\regedit.exe /I /S %0\..\kixchng.reg
%WINDIR%\regedit.exe /I /S %0\..\loclpass.reg
ECHO Finished Verifying/Upating Script Installation.
GOTO Runscript

:WinNT
XCOPY %0\..\KIX32.EXE %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
IF EXIST %WINDIR%\SYSTEM32\KX16.DLL DEL /F %WINDIR%\SYSTEM32\KX16.DLL
IF EXIST %WINDIR%\SYSTEM32\KX32.DLL DEL /F %WINDIR%\SYSTEM32\KX32.DLL
IF EXIST %WINDIR%\SYSTEM32\KX95.DLL DEL /F %WINDIR%\SYSTEM32\KX95.DLL
IF EXIST %WINDIR%\SYSTEM32\KXRPC.EXE DEL /F %WINDIR%\SYSTEM32\KXRPC.EXE

ECHO Finished Verifying/Upating Script Installation.
GOTO Runscript

:RunScript
CLS
ECHO Mapping NT Directories Please Wait...

%0\..\kix32.exe maps.kix

EXIT

This works v nice and especially useful when upgrading to a new version of Kixtart.

Good Luck

------------------
Don Davidson
Network Engineer
http://www.insight-media.co.uk

Top
#48334 - 1999-10-11 06:59 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


I think I was wrong in my question, Sorry !
How Can I test if one or several files do not exist in a directory.
I don't want to use : IF EXIST.
My task is to test if the file is not present. If the file is not there thent I copy the file from the server to the workstation.
Thanks

Top
#48335 - 1999-10-11 07:07 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


Thanks Don for you answer.

Top
#48336 - 1999-10-11 08:56 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


Hi Jacques

I think the XCOPY command as above should do the trick. try it out on a test user & system.
/D only copies files over if source file is newer
/H copies hidden and or system files
/I If destination does not exist and copying more than one file, assumes that destination MUST be a directory.
/R Overwrites read only files.
/V Verifies each new file
> Nul If the file isn't there copy it over

Also should your line, if not exists "%systemroot%\system32\myfile.dll" read if not exists "%WINDIR%\system32\myfile.dll" Give it a go.

Regards


------------------
Don Davidson
Network Engineer
http://www.insight-media.co.uk

Top
#48337 - 1999-10-12 02:59 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


Thanks Don, it's a goo idea.
But can't we do that inside the Kix script instead of calling an external batch file ?

Thks,
Jacques JOCELYN

Top
#48338 - 1999-10-12 03:05 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


You said you don't want to use IF EXIST, but I realy don't understand why not ??
As in KiX the NOT operator is not excisting you need to use the If EXIST...

example solution for your problem:

code:

IF EXIST(C:\autoexec.bat)
ELSE
copy "%0\..\file1.xx" "c:\autoexec.bat"
ENDIF


------------------
Lon Geefshuysen (MCP)
kixtart.to/lon
lon@kixtart.to



Top
#48339 - 1999-10-12 04:32 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


Doohhhh !

Why didn't I think about That before !!
I'm feeling so stupid :-))

Many Thanks a lot LON.
Regards,
Jacques

Top
#48340 - 1999-10-12 07:42 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


Oops

Me too!

Nice one Lon.

Top
#48341 - 1999-10-14 01:04 AM Re: How to test if a file exist on the client PC
Anonymous
Unregistered


Your code should also work if you use exist (instaed of exists), eg

if not exist "%systemroot%\system32\myfile.dll"
...

Regards
Niaz

Top
Page 1 of 1 1


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

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.053 seconds in which 0.024 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