[Tutor] python win32 drive mapping help
Vineet Kothari
vineet.kothari at gmail.com
Fri Sep 25 01:57:31 CEST 2009
Can you also help me out with the way to delete the mapped drive I know in
command line it is
> net use [DRIVE:] /delete
>
but I am unable to figure out how I can do it from python
Since I am trying to make sure that the drive name I am giving in my code:
> import win32net
> win32net.NetUseAdd(None,1,{'remote':r'\\server\share','local':'K:','password':'XXX'
> })
K: drive should not exist already & if it does then the mapping should be
removed first & then a new mapping should be established.
So it should be going something like:
if [mapping already exists]:
> [delete mapping]
> else:
> [create new mapping]
>
Thank You everyone for the help :)
--
Regards,
Vineet Kothari
http://www.vineetkothari.in
-----
Its NICE 2 be IMPORTANT, but whats more IMPORTANT is 2 be NICE.
On Tue, Sep 22, 2009 at 4:01 AM, vishwajeet singh <dextrous85 at gmail.com>wrote:
> On Tue, Sep 22, 2009 at 5:38 AM, Vineet Kothari <vineet.kothari at gmail.com>wrote:
>
>>
>> Hi Everyone
>>
>> I saw alot of responses for python on this <http://python.org> mailing
>> list. I thought any python guru might wish to help me with little code to
>> map two network drives on windows systems
>>
>>
>> I have 3computers at different locations in a network A,B,C
>>
>> 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'
>>> })
>>>
>>
>> but I get this error:
>>
>> C:\Users\Administrator\Desktop>python test.py
>>> Traceback (most recent call last):
>>> File "test.py", line 31, in <module>
>>> import win32wnet
>>> ImportError: No module named win32net
>>>
>>
>> I just need help in setting up the mapping. I know how to do the copying
>> using shutil please if you can help me with the mapping code. I am very new
>> to python and I need this help for my project at school.
>>
>> I am using python 2.6
>>
>> I'll be eagerly waiting for your response.
>> Thanks
>>
>> --
>> Regards,
>> Vineet Kothari
>> http://www.vineetkothari.in
>>
>> -----
>> Its NICE 2 be IMPORTANT, but whats more IMPORTANT is 2 be NICE.
>>
>>
>>
>> _______________________________________________
>> Tutor maillist - Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
> You need python extension installed on your machine to be able to execute
> the above code; you can get same from
> http://sourceforge.net/projects/pywin32/
>
> --
> Vishwajeet Singh
> +91-9657702154 | dextrous85 at gmail.com | http://singhvishwajeet.com
> Twitter: http://twitter.com/vishwajeets | LinkedIn:
> http://www.linkedin.com/in/singhvishwajeet
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090924/577c10a6/attachment.htm>
More information about the Tutor
mailing list