We do this all the time. There is a file C:/hosts.txt which lists all the hosts on the network - one host per line. It looks like the following.
C:/hosts.txt Quote:
Computer1
Computer2
.
.
.
|
Then there is a file that contains a list of files to be pushed, C:/files.txt. It looks like the following.
C:/files.txt Quote:
C:/APLIT/Reports/Daily/Manager.rpt
C:/APLIT/Reports/Daily/SalesAssociate.rpt
C:/APLIT/Reports/Weekly/Manager.rpt
C:/APLIT/Reports/Weekly/SalesAssociate.rpt
|
Then this script, run from one computer, will push each file in files.txt to the exact same location to each host in file hosts.txt, while saving the previous files as _saved.
Code:
# Script PushFiles.txt
var str filelist, file, hostlist, host, destfile, saveddestfile
# Read the file list.
cat "C:/files.txt" > $filelist
# Get the first file.
lex "1" $filelist > $file
# Go thru files one by one.
while ($file <> "")
do
# Read the host list.
cat "C:/hosts.txt" > $hostlist
# Get the first host.
lex "1" $hostlist > $host
# Go thru the hosts one by one.
while ($host <> "")
do
# We have the source file in $file. The destination file is
# gotten by replacing the "C:/" part with "//Computer1/".
sal -p "^:/^]" ("//"+$host+"/") $file > $destfile
# Destination file in now $destfile. Copy it first to _saved.
set $saveddestfile = $destfile+"_saved"
# Save the previous destination file, if exists.
echo -e "DEBUG: Copying " $destfile " to " $saveddestfile
system -s "copy /Y" ("\""+$destfile+"\"") ("\""+$saveddestfile+"\"")
# Copy $file onto $destfile.
echo -e "DEBUG: Copying " $destfile " to " $destfile
system -s "copy /Y" ("\""+$file+"\"") ("\""+$destfile+"\"")
# Get the next host.
lex "1" $hostlist > $host
done
# Get the next file to push.
lex "1" $filelist > $file
done
Script is in biterscripting (
http://www.biterscripting.com ). Save the script in file, say, "C:/Scripts/PushFiles.txt". Run it as
Code:
script "C:/Scripts/PushFiles.txt"
Test first in your environment - particularly, you may need to experiment with the "//Computer1/APLIT/Reports/Weekly/Manager.rpt" syntax. On some networks, you may need to experiment with this syntax.
You can write a mirror script to revert the changes. But I will leave it up to you to do that.