Download file from windows shared drive faster

531 Views Asked by At

I need to download files from remote shared drive in my local system, and for that I'm using pysmb library to make a connection.

The code is as follows:

import pysmb

conn = SMBConnection(username, password, client_machine_name, server_name, 
use_ntlm_v2=True)
conn.connect(host, 139)
with open("local_file.txt", "wb") as local_file:
     conn.retrieveFile(share, file_path, local_file)

It takes 5 min to download 200mb file, even though my internet speed is decent.

Any optimisation or alternate method to download the files faster?

1

There are 1 best solutions below

0
On

To improve the download speed and reduce the time it takes to transfer files from a remote shared drive using the pysmb library, you can try using a different port, increasing the buffer size, using multithreading, or using a different library such as pycifs, smbprotocol, or smb.

You can also use a download manager like wget or curl, which are optimized for high-speed downloads and can have multiple connections, alongside other optimizations to improve transfer speeds.

Implementing one or more of these solutions may help improve your download speeds.