Multithreaded FTP upload. Is it possible?

I need to upload several files from a directory to a server via FTP and SFTP. I solved this problem for SFTP using python, paramiko and threading. But I have a problem doing this for FTP. I tried using ftplib for python, but it seems that it doesn’t support streaming, and I upload all the files one by one, which is very slow.

I am wondering if it is possible to make multi-threaded downloads with the FTP protocol without creating separate connections / authorizations (it takes too much time)?

The solution can be in Python or PHP. Maybe CURL? I would be grateful for any ideas.

+3
source share
4 answers

Another approach to concurrency, in addition, is asynchronous io. For Python, Twisted is the standard toolkit for asynchronous networking .

Take a look at this example FTP client in Twisted.

+1
source

, - pycurl.

, , , .

: http://pycurl.cvs.sourceforge.net/pycurl/pycurl/examples/

retriever-multi.py file_upload.py , .

0

You can run the script in several command prompts / shells (just make sure that each file is processed once by all different scripts). I'm not sure if this quick and dirty trick will improve the transfer speed though ..

0
source

Source: https://habr.com/ru/post/1739673/


All Articles