Page 1 of 1 1
Topic Options
#41129 - 2003-06-05 05:06 PM Help with KIX
caseman Offline
Lurker

Registered: 2003-06-05
Posts: 4
Loc: Newark, DE
I need a script to read computer names from a text file then copy a paticular file from each machine to a certain location. Does anyone anready have such a script or can you give me some ideas. thanks.
Top
#41130 - 2003-06-05 05:18 PM Re: Help with KIX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Could you flesh out your requirements a bit, questions that come to mind:

1) Will this be a straight UNC copy from shares ?

2) Will drives need to be mapped and unmapped ?

3) Will the target device be the local machine ?

4) Will the files have to be renamed with source machine specific details ?

5) How many machines ? Will the list remain static or need much maintenance going forward ?

-Shawn

Top
#41131 - 2003-06-05 05:18 PM Re: Help with KIX
New Mexico Mark Offline
Hey THIS is FUN
****

Registered: 2002-01-03
Posts: 223
Loc: Columbia, SC
Unless you are renaming or doing something more complex, a simple one-line batch file (I'm assuming NT4, W2K, or XP) might suit you best.

for /f "tokens=1 delims==" %%i in (serverlistfile) do copy myfile \\%%i\share\dir\

Top
#41132 - 2003-06-05 05:32 PM Re: Help with KIX
caseman Offline
Lurker

Registered: 2003-06-05
Posts: 4
Loc: Newark, DE
Sorry, here are some more details.
I would be copying from UNC path to a local machine. the file name is the same on each machine so it would have to renamed during the copy. Drives will not need to mapped, this will be done with about 30 machines.
thanks.

Top
#41133 - 2003-06-05 05:39 PM Re: Help with KIX
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Take a look at the KiXtart Manual under READLINE/OPEN/CLOSE and the FAQ Forum under File Input/Output Primer

[ 05. June 2003, 17:53: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#41134 - 2003-06-05 06:04 PM Re: Help with KIX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ok, heres a quicky based on the way I like to do this sort of thing, up to you if you want to persue this:

1) Create a file called HOSTS.INI in your current directory, heres a sample:

[HOSTS.INI]
code:
[todo]
server1 = 1
server2 = 1
server3 = 1
server4 = 1

[done]

Notice there are two sections TODO and DONE. The todo section contains the list of all the machines to copy the file from. As the files are copied, and if the copy was successfull, the hostname "moves" from the TODO section to the DONE section. That way, if a machine is down or not available, all you have to do is rerun the script, and the script will automatically restart and attempt to copy files from the failed machines.

To reset this script for the another copy, simply (manually) rename the DONE section to TODO, and delete the old TODO section.

Anyways, hope you get the picture. Heres a the script - you must customize it to your environment, good luck:

code:
Break On

$HOSTS = ".\HOSTS.INI"

$SHARE = "\BUILDS\XML\ENG\"
$FILE = "MSXML.MSI"
$TARGET = @CURDIR

For Each $Host In Split(ReadProfileString($HOSTS,"TODO",""),CHR(10))

If $Host

$SRC = "\\"+$HOST+$SHARE+$FILE
$TGT = $TARGET+$HOST+"_"+$FILE

?"Copying $SRC to $TGT"

COPY $SRC $TGT

?@SERROR
?

If @ERROR = 0

$= WriteProfileString($HOSTS,"TODO",$Host,"")
$= WriteProfileString($HOSTS,"DONE",$Host,1)

EndIf

EndIf

Next

Exit 1


Top
#41135 - 2003-06-05 06:35 PM Re: Help with KIX
caseman Offline
Lurker

Registered: 2003-06-05
Posts: 4
Loc: Newark, DE
Thanks Shawn, however i get this error message.

Script error : Unknown command !
For Each $Host In Split(ReadProfileString($HOSTS,"todo",""),CHR(10))

I am using version 3.55. if that is the issue where can i find the newest version?

thanks again.

Top
#41136 - 2003-06-05 06:40 PM Re: Help with KIX
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You will need an upgrade.

http://www.scriptlogic.com/kixtart/default.asp
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#41137 - 2003-06-05 09:39 PM Re: Help with KIX
caseman Offline
Lurker

Registered: 2003-06-05
Posts: 4
Loc: Newark, DE
I was able to get it to work Shawn. Thanks for your help everyone.
Top
#41138 - 2003-06-05 10:16 PM Re: Help with KIX
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Glad to be of assistance, anytime! Hope this helped the cause.
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 857 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

Generated in 0.059 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