jborean93 / smbprotocol

Python SMBv2 and v3 Client
MIT License
323 stars 73 forks source link

How to List Files and Read with Pandas in a Remote Directory #243

Closed Ricmelis80 closed 1 year ago

Ricmelis80 commented 1 year ago

I would like to print a list of files contained in a folder from my remote server (needs authentication with user and pass).

Also, I would like to open .csv or excel files using pandas.

How can I achieve this using smbprotocol-based coding?

Thanks in advance!

jborean93 commented 1 year ago

You can use smbclient.listdir or smbclient.scandir for enumerating directory entries. You can use smbclient.open_file to open files for reading and writing. Essentially the smbclient namespace is designed to reflect the functions that are in the builtin os namespace in Python so if you can do it in os you can most likely do it with smbclient. As for how to get it working in pandas I'm not sure, I don't use the project so I can't really help you there.

Ricmelis80 commented 1 year ago

Hy Jordan,

Thanks a lot for useful suggestions ATB!