Popcorn Sutton Posted July 7, 2014 Posted July 7, 2014 I've been searching how to enumerate files from a network directory for a couple hours now with no luck. I need to be able to do this with Python for an application that I am working on.Methods tried so far-import os>>> print os.path.splitextfrom os import listdir>>> from os.path import isfile, join>>> onlyfiles = [f for f in listdir("smb:///dw_fileserver/") if isfile(join("smb:///dw_fileserver/", f))]os.walk("smb:///dw_fileserver/") I don't think that anyone will be able to help, but I'm taking a shot in the dark at this point. I'm using Samba to connect to the file sharing network. There's either no answer to this question or I'm searching the wrong question. GRRRRRRR rawr!
Sensei Posted July 7, 2014 Posted July 7, 2014 Why three / ? Did you tried: os.walk("smb://dw_fileserver/") or os.walk("smb://dw_fileserver") ? I was using smb path on mine MacOS X, and I could swear it had smb://192.168.0.2/ .... But maybe mine memory is failing at middle of night. Tried using IP address instead of name?
Popcorn Sutton Posted July 7, 2014 Author Posted July 7, 2014 I haven't tried that. I was looking into smbclient to help with the process but there is no documentation. Every example that I've found are not thorough enough. Looks like I got some homework to do.
Sensei Posted July 7, 2014 Posted July 7, 2014 (edited) BTW, on Windows when we use from command line: dir "\\192.168.0.2\" there is error "name of file, volume, or directory incorrect". But if we will use f.e. dir "\\192.168.0.2\SharedDocs", it's working as expected. Basically directory listing functions can't work to list volumes. Not sure about Unix implementation. You might search google for "list volumes linux" or so. Edited July 7, 2014 by Sensei
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now