Emmanuel
Emmanuel

Reputation: 14209

Check if symbolic link on Samba share with python

Can I know with Python from Windows if some files that I have access to on a Samba share are "real" files or symbolic links ? I tried os.path.islink but it returns false as the documentation states:

Always False if symbolic links are not supported

Is there any other way ?

Upvotes: 4

Views: 1973

Answers (1)

INS
INS

Reputation: 10820

I used pysmb to access samba shares from python and I found that according to the MS documentation the (symbolic) link was not taken into account in the protocol specification.

I also tested with smbclient under Linux (Ubuntu) and there is no difference between links and directory.

So this seems to be a limitation of the samba specification.

PS: A project of mine aims to scan recursively a directory structure (samba share), which can loop forever in case of a symbolic link, since I cannot determine if it's a real directory or symbolic link.

Upvotes: 3

Related Questions