This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A tool used to manage net drive in Windows platform.

Project Description

NetDrive

A tool used to manage netdrive in Windows Platform.

Usage

The mainly functions are found in the python extension: netuse

python setup.py build

Or you can use your prefer way to build netuse.c, get the extension netuse. It exports the following functions:

  • autoConnect()

    Create mapped drive from shared folder, it uses the default user name. (provided by the user context for the process.)

    Raise exception if something is wrong.

  • listNetDrive()

    List all the net drives visible by current user. Return a list:

    [ (drive, remote, status, user), … ]

    Not that if the calling application is running in a different logon session than the application that made the connection, it’s unvisible for the current application. If the current user has administrator privilege, these connections could be shown, but the status is unavaliable or unconnect.

    Refer to Defining an MS-DOS Device Name

    http://msdn.microsoft.com/en-us/library/windows/desktop/aa363908(v=vs.85).aspx

    Refer to Local and Global MS-DOS Device Names

    http://msdn.microsoft.com/en-us/library/windows/hardware/ff554302(v=vs.85).aspx

  • mapNetDrive(remote, drive, user=None, password=None)

    Create net drive from remote folder, and return the assigned drive letter.

    It uses the default user which initialize this remote connection if user is None.

    When drive is an empty string, the system will automatically assigns network drive letters, letters are assigned beginning with Z:, then Y:, and ending with C:.

    For examples

    mapNetDrive(r’\server\data’)

    mapNetDrive(r’\server\data’, ‘T:’)

    mapNetDrive(r’\server\data’, ‘T:’, r’\server\jack’, ‘abc’)

    Raise exception if something is wrong.

  • removeNetDrive(drive, force=True)

    Remove mapped drive specified by drive, For example,

    removeNetDrive(‘X:’)

    Parameter force specifies whether the disconnection should occur if there are open files or jobs on the connection. If this parameter is FALSE, the function fails if there are open files or jobs.

    Raise exception if something is wrong, otherwise return None.

  • usageReport(drive)

    Return a tuple to report the usage of the net drive:

    (available, total)

    For examples,

    usageReport(‘Z:’)

    Raise exception if something is wrong.

  • userInfo()

    Get the logon user information, return a tuple:

    (server, domain, user)

Examples

It’s easy to use, just like a common python library.

import netuse

# Get mapped net drive

print netuse.listNetDrive()

# Map a new drive, return the drive letter

print netuse.mapNetDrive(r’\serverpath’)

# Remove a mapped drive

netuse.removeNetDrive(‘Z:’)

# Get the usage of net drive: ( free bytes, total bytes )

print netuse.usageReport(‘Z:’)

Release History

Release History

This version
History Node

0.2.0

History Node

0.1.3

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
netdrive-0.2.0.tar.gz (11.9 kB) Copy SHA256 Checksum SHA256 Source Sep 17, 2013

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting