scan WIN directories with UNC pathnames

T

Thomas Rademacher

Hallo,

my application want to scan WIN directories with UNC pathnames.

The methods os.path.isdir(pathname) and os.listdir(pathname) work fine with
pathname="\\\\servername\\path".
But with the argument pathname="\\\\servername" the method
os.path.isdir(pathname) returns 0 and the method os.listdir(pathname) raises
an exception.

What is the reason? And how can I scan such UNC directories
(pathname="\\\\servername")?

I must work with python2.2 WITHOUT additional modules (win32wnet, ...).

Tnank's for your hints Thomas
 
M

Michel Claveau, résurectionné d'outre-bombe inform

Hi !


Hard, directly. But, you can try :



import os,os.path

ret=os.popen('net use X: \\\\SSEERRVV\\C$','r')
print ret
print os.path.isdir('X:\\DDIIRR')




If you have the rights.
 
M

Michel Claveau, résurectionné d'outre-bombe inform

Sorry, I had bad read.

\\\\SSRRVV is not a directory ; it's a node in the LAN. Think a server of
(only) print ; you have \\\\SSRRVV\\Hp (for sample) and it's no a
directory (no files).


* sorry for my bad english *


Michel Claveau
 
P

Peter Hansen

Thomas said:
Hallo,

my application want to scan WIN directories with UNC pathnames.

The methods os.path.isdir(pathname) and os.listdir(pathname) work fine with
pathname="\\\\servername\\path".
But with the argument pathname="\\\\servername" the method
os.path.isdir(pathname) returns 0 and the method os.listdir(pathname) raises
an exception.

What is the reason? And how can I scan such UNC directories
(pathname="\\\\servername")?

What Tim said.... and as further clarification, what you show above
as \\servername\path is not valid. It's actually \\servername\share,
where the "\share" part effectively represents the root directory
of the shared folder. Think of it as being no different than "C:\".

Note that if you do "dir \\servername" at a DOS prompt, you'll get
the same sort of errors as what you got above:

"The filename, directory name, or volume label syntax is incorrect."

-Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top