General discussion

Locked

Windows NT Script

By teo ·
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

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Windows NT Script

by msheehan In reply to Windows NT Script

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" )

Collapse -

Windows NT Script

by teo In reply to Windows NT Script

The question was auto-closed by TechRepublic

Collapse -

Windows NT Script

by ronny.lydou In reply to Windows NT Script

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.

Collapse -

Windows NT Script

by teo In reply to Windows NT Script

The question was auto-closed by TechRepublic

Collapse -

Windows NT Script

by teo In reply to Windows NT Script

This question was auto closed due to inactivity

Back to Windows Forum
5 total posts (Page 1 of 1)  

Operating Systems Forums