Discussion Locked

Windows NT Script

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am trying to write a script to do the following tasks when a user logon to a server :

1 Compare the datestamp of 2 files (file1 and file2) from 2 different directories on the server (dir1 and dir2)

2 If file2 datestamp from dir2 is later than file1 datestamp from dir1, copy all files from dir2 to local workstation temp directory

3 Copy file2 from dir2 to file1 from dir1 (To overwrite file1 with file2)

How can I do it ?

Thank you

5 replies

by msheehan

Well, hopefully you're open to KIXStart script...

Using KIX (I think you need 3.6.2 ??) you can do this:

1) COMPAREFILETIMES("file1", "file2")
This returs:
1 - file1 is more recent then 2
0 - they have the same date
-1 - file2 is more recent then file1
-2 - file1 could not be opened
-3 - file2 could not be opened

so for # 2 you get :

$Result = CompareFileTimes ("c:\text1.txt" , "e:\text2.txt")
if $Result = -1
COPY "c:\*.*" "c:\temp"
COPY "e:\text2.txt" "c:\text1.txt"-Mike
(yes, you can use vaiable for directories:
$drive1 = c
copy $drive1 + "\text1.txt" )

by ronny.lydou

This is a task that can be done with Kix32.
The latest version is 3.62 and you can download it from http://netnet.net/~swilson/kix.
The differend problems can be solved with the COMPAREFILETIMES instruction.
Depending on the result of the compare, you can use the copy command to make the actual copy.

In the NETLOGON share of the PDC and all BDC's you must place the KIX32.EXE file and the script file.
Start the usermanager for domains and open the profile for the user. Use the syntax "KIX32.EXE MyScript.SCR" for the Login Script name.

This discussion is closed to new replies.