[python-win32] getting a remote file

Tim Golden tim.golden at viacom-outdoor.co.uk
Tue Aug 26 15:29:58 EDT 2003


From: Nate Gelbard [mailto:gelbardn at tripwire.com]
> Using WMI, how can I get the contents of a remote file?
> I need to harvest a text file containing a version string
> and return the contents over WMI. Any suggestions?

I don't think there's a terribly easy answer to this: WMI isn't
a file transfer protocol, and while you could use the Copy
method of a CIM_DataFile object to copy a file, that's no
better than using any other method within Windows.

ie if you can do:

   for f in wmi.WMI ().CIM_DataFile (Name="c:\\temp\\blah.txt"):
     f.Copy (r"\\my_machine\blah\%s" % f.Name) 

then you could probably do something like:

   shutil.copyfile (r"\\othermachine\blah\blah.txt",
r"\\my_machine\blah\blah.txt")

unless I've missed your point. Please feel free to jump
in and point out my shortsightedness.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-win32 mailing list