I want to transfer a large file with
adb pull, but my USB connection disconnects all the time, interrupting the transfer. How can I make this work?
Here's a Python 3 script that implements a workaround based on
dd. It continuously retries and resumes download when disconnection happens.
For me the performance is the same as
adb pull. If you experience problems with performance—try to play with BUFFER_SIZE value.
ADB can not pull files partially or resume. Also modifying the PC side of ADB is AFAIK of no use to you, as the provided functionality is provided by the on-device part (which you can't replace).
From my point of view there are two possibilities left:
Install an FTP server (app) that allows to automatically start with Android and that is able resume the download. Let is share a directory, the file you want to get is located in, or use your 20 seconds time window to move the file into the FTP shared directory.
Another option would be a cloud synchronization app (or command-line tool you could call via adb) that is able to push files automatically block-wise to the server (like the DropBox desktop client does). Unfortunately AFAIK the official Android DropBox client works differently and is of no use for you in this scenario. But some 3rd party Dropbox app or a different cloud sync app may be usable.