Copying files to multiple comp's on a lan
Henrik Berg Nielsen
hbn at imada.sdu.dk
Sun Jun 3 17:11:09 CEST 2001
I got the win32all as Mark suggested and everything works like a charm now!
Just one more question:
Is it possible to
cmd_string = "copy %s %s" % ("\\Machine1\C\temp\foo.txt",
when I am sitting and issuing the command from Machine0?
I'd like to design the script so that it copies the file to/from multiple
comps at one time, not just from the source to all the other machines one at
a time seperately, but more like:
copy from comp0 to comp1
copy from comp0 to comp2
copy from comp1 to comp3
copy from comp0 to comp4
copy from comp1 to comp5
copy from comp2 to comp6
copy from comp3 to comp7
and so on and so on...
where comp0 would be the initial source
Is this possible at all? Doing it this way would make better use of the
network, its switched, so collisions should be a problem, although the
traffic will be immense if I'm disting a 700 MB file.
All for now,
Henrik Berg Nielsen
"Mark Hammond" <MarkH at ActiveState.com> wrote in message
news:3B198B17.3060409 at ActiveState.com...
> Henrik Berg Nielsen wrote:
> > programming). So far I haven't been able to access file on the remote
> > machines via the open() method. What should I write if I wanted to
> > the file called "foo.txt" located in the "temp" folder on the C drive of
> > machine named "Orion"?
> In general, you need to know how the C:\TEMP directory is "shared" by
> the machine "Orion". If you have administrator rights, you will
> probably find that:
> will work. In general, whatever string you can pass to the command
> prompt's "dir" command to see the file can be passed to open().
> Remember that Python sometimes requires backslashes to be doubled -
> hence my r"..." notation above - it uses raw strings which do generally
> not need slashes doubled. ie, without raw strings, you would need to
> say "\\\\Orion\\c$\\temp"
> If you don't have access to the 'C$' share, then you need to investigate
> the specific settings for the specific server. There are some obscure
> ways to determine this stuff programatically, but let's get the simple
> things working first :)
> > I like the approach more where I let os.system() do the copying for me,
> > it really doesn't work all that good if I can't assemble the proper
> > paths.
> Experiment with assembling the paths from the command prompt.
> > On a side note; what does os.sytem() do specifically?
> Executes the command - almost as if you typed the command from a DOS
> > Also I tried "import win32api, win32file, win32net" and it can't find
> > neither of them, should I install these seperately or what? (plz don't
> > :))
> You probably need win32all from
> If you installed ActivePython itself, they should all be there already.
More information about the Python-list