Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8240

Re: connect windows share

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <mail@timgolden.me.uk>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python.': 0.04; 'from:addr:timgolden.me.uk': 0.09; 'from:name:tim golden': 0.09; 'ldap': 0.09; 'message-id:@timgolden.me.uk': 0.09; 'recursively': 0.09; 'skip:\\ 10': 0.09; 'sub': 0.09; 'subject:windows': 0.09; 'linux': 0.11; 'wrote:': 0.14; 'altman': 0.16; 'filenames': 0.16; 'input.': 0.16; 'os.walk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'shares.': 0.16; 'travis': 0.16; 'cc:addr:python-list': 0.17; 'this?': 0.19; 'header:In- Reply-To:1': 0.21; 'mechanism': 0.22; 'cc:2**0': 0.22; 'stuff': 0.22; 'maybe': 0.23; 'cc:no real name:2**0': 0.23; "what's": 0.23; 'do,': 0.25; 'essential': 0.26; 'windows': 0.26; "i'm": 0.27; 'thanks': 0.28; 'import': 0.29; 'skip:( 20': 0.30; 'cc:addr:python.org': 0.30; 'tjg': 0.30; 'it.': 0.31; 'equivalent': 0.31; 'file': 0.34; 'header:User-Agent:1': 0.35; 'test': 0.35; 'subject:: ': 0.38; 'received:192': 0.38; 'unless': 0.39; 'allows': 0.40; 'really': 0.40; 'more': 0.60; 'best': 0.60; 'your': 0.60; 'address': 0.62; 'play': 0.64; 'from:addr:mail': 0.65; 'share': 0.67; 'afraid': 0.72; 'easy:': 0.84; 'eye,': 0.84; 'subject:share': 0.84; 'presumably': 0.91; 'subject:connect': 0.91; 'to:none': 0.93
Date Wed, 22 Jun 2011 19:59:48 +0100
From Tim Golden <mail@timgolden.me.uk>
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10
MIME-Version 1.0
CC python-list@python.org
Subject Re: connect windows share
References <BANLkTimy+qLhjV9Z5DeGLV1P2fsWR+RPfQ@mail.gmail.com>
In-Reply-To <BANLkTimy+qLhjV9Z5DeGLV1P2fsWR+RPfQ@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.295.1308769209.1164.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 82.94.164.166
X-Trace 1308769209 news.xs4all.nl 14144 [::ffff:82.94.164.166]:53262
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8240

Show key headers only | View raw


On 22/06/2011 19:38, Travis Altman wrote:
> I want to be able to connect to a windows share via python.  My end goal
> is to be able to recursively search through windows shares.  I want to
> do this in Linux as well.  So given a share such as \\computer\test I
> would like to search through the test directory and any sub directories
> for any file names of interest.  What's the best way of going about
> this?  I know LDAP / AD creds may play an essential part in this as
> well.  Thanks for your input.

Unless there's more to this than meets the eye, the answer's
really easy: just do it.

On Windows, you just do, eg:

import os

for dirpath, dirnames, filenames in os.walk (r"\\computer\test"):
   # do stuff with stuff

Presumably on Linux you have to use whatever mechanism allows
you to address Windows shares in the equivalent way. Maybe

os.walk ("smb://computer/test") ?? I'm not really a Linux person,
I'm afraid

TJG

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: connect windows share Tim Golden <mail@timgolden.me.uk> - 2011-06-22 19:59 +0100

csiph-web