"Vineet Kothari" <vineet.koth...@gmail.com> wrote

I want to map c:/temp folder of A to C & c:/temp folder of B to C as well do
some copying of data and then delete the mapping.

I tried using the code given for mapping:

import win32net
win32net.NetUseAdd(None,1,{'remote':r'\\server\share','local':'K:','password':'XXX'
})

Nobody else has mentioned it so I thought I'd point out that this is
a bit simpler (IMHO) if done via WSH COM objects. You just create
a WSH Network Object then call it's methods:

MapNetworkDrive(localName,remotePath)
RemoveNetworkDrive(localName)

There are additional optional parameters for adding to profile or using
another user name etc.

I usually use WSH for most Windows system admin type stuff.
(Although I confess I use VBScript to drive WSH rather than Python!!)
Caveat: WSH is not always installed/enabled on all PCs but nowadays
is usually there. I haven't had a case of it being missing since we
stopped using the Windows 9X series of OS.

Just a thought.

PS.
There are similarly simple methods for adding/removing Printers too.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to